<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>EasyRTC Documentation</title>
  <script src="scripts/prettify/prettify.js"> </script>
  <script src="scripts/prettify/lang-css.js"> </script>
  <!--[if lt IE 9]>
    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  <![endif]-->
  <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
  <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
  <link href="../assets/easyrtc-docs-jsdoc-styles-1.css" media="all" rel="stylesheet" />
</head>
<body>
<header class="template">
	<div class="wrapper-content">
    <a href="../index.html"><img src="../assets/easyrtc-logo.png" alt="EasyRTC Documentation"></a>
		<h1 title="EasyRTC Documentation">Documentation</h1>
	</div>
</header>
<div class="wrapper-docs">
<nav>
	<h2><a href="../index.html">Docs Home</a></h2>
	<h3>EasyRTC Guides</h3>
	<ul>
		<li><a href="../easyrtc_faq.html">FAQ</a></li>
		<li><a href="../easyrtc_gettingStarted.html">Getting Started</a></li>
		<li><a href="../easyrtc_server_install.html">EasyRTC Server: Installation</a></li>
		<li><a href="../easyrtc_client_tutorial.html">EasyRTC Framework Tutorial</a></li>
		<li><a href="../easyrtc_rooms.html">Rooms</a></li>
		<li><a href="../easyrtc_server_configuration.html">EasyRTC Server: Configuration</a></li>
		<li><a href="../easyrtc_server_events.html">EasyRTC Server: Events</a></li>
		<li><a href="../easyrtc_server_ice.html">EasyRTC Server: ICE Configuration</a></li>
		<li><a href="../easyrtc_with_other_servers.html">Using Alongside Other Servers</a></li>
		<li><a href="../easyrtc_server_ssl.html">EasyRTC Server: Using SSL</a></li>
		<li><a href="../easyrtc_webrtc_problems.html">WebRTC Problems and Possible Fixes</a></li>
		<li><a href="../easyrtc_upcoming_features.html">Upcoming Features</a></li>
		<li><a href="../easyrtc_changelog.html">Change Log</a></li>
	</ul>
	<h3>EasyRTC Client Classes</h3>
	<ul>
		<li><a href="../client-api/Easyrtc.html">Easyrtc</a></li>
		<li><a href="../client-api/Easyrtc_App.html">Easyrtc_App</a></li>
		<li><a href="../client-api/Easyrtc_ft.html">Easyrtc_ft</a></li>
		<li><a href="../client-api/Easyrtc_IframeCapture.html">Easyrtc_IframeCapture</a></li>
		<li><a href="../client-api/Easyrtc_No_IframeCapture.html">Easyrtc_No_IframeCapture</a></li>
		<li><a href="../client-api/Easyrtc_Rates.html">Easyrtc_Rates</a></li>
		<li><a href="../client-api/Easyrtc_Recorder.html">Easyrtc_Recorder</a></li>
	</ul>
	<h3>EasyRTC Server Modules</h3>
	<ul>
		<li><a href="../server-api/module-easyrtc_default_event_listeners.html">easyrtc_default_event_listeners</a></li>
		<li><a href="../server-api/module-easyrtc_default_options.html">easyrtc_default_options</a></li>
		<li><a href="../server-api/module-easyrtc_private_obj.html">easyrtc_private_obj</a></li>
		<li><a href="../server-api/module-easyrtc_public_obj.html">easyrtc_public_obj</a></li>
		<li><a href="../server-api/module-easyrtc_util.html">easyrtc_util</a></li>
		<li><a href="../server-api/module-general_util.html">general_util</a></li>
	</ul>
	<h3>EasyRTC Server Classes</h3>
	<ul>
		<li><a href="../server-api/module-easyrtc_default_event_listeners-eventListener.html">eventListener</a></li>
		<li><a href="../server-api/module-easyrtc_public_obj-pub.html">pub</a></li>
		<li><a href="../server-api/module-easyrtc_public_obj-pub.events.html">events</a></li>
		<li><a href="../server-api/module-easyrtc_public_obj-pub.util.html">util</a></li>
		<li><a href="../server-api/module-easyrtc_util-eu.html">eu</a></li>
		<li><a href="../server-api/module-general_util-g.html">g</a></li>
		<li><a href="../server-api/pub.appObj.html">appObj</a></li>
		<li><a href="../server-api/pub.appObj.connectionObj.html">connectionObj</a></li>
		<li><a href="../server-api/pub.appObj.connectionObj.connectionRoomObj.html">connectionRoomObj</a></li>
		<li><a href="../server-api/pub.appObj.roomObj.html">roomObj</a></li>
		<li><a href="../server-api/pub.appObj.sessionObj.html">sessionObj</a></li>
	</ul>
</nav>
<div class="easyrtc-docs-content">
<div id="main">
<h1 class="page-title">Source: easyrtc_default_event_listeners.js</h1>
<section>
<article>
<pre class="prettyprint source linenums easyrtc"><code><a name="line1"></a><div class="linenumber">1</div><div style="width:0em;display:inline-block"></div>/*&nbsp;global&nbsp;module,&nbsp;require,&nbsp;console,&nbsp;__dirname&nbsp;*/
<a name="line2"></a><div class="linenumber">2</div><div style="width:0em;display:inline-block"></div>/**
<a name="line3"></a><div class="linenumber">3</div><div style="width:0em;display:inline-block"></div>*&nbsp;Event&nbsp;listeners&nbsp;used&nbsp;by&nbsp;EasyRTC.&nbsp;Many&nbsp;of&nbsp;these&nbsp;can&nbsp;be&nbsp;overridden&nbsp;using&nbsp;server&nbsp;options.
<a name="line4"></a><div class="linenumber">4</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line5"></a><div class="linenumber">5</div><div style="width:0em;display:inline-block"></div>*&nbsp;@module&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;easyrtc_default_event_listeners
<a name="line6"></a><div class="linenumber">6</div><div style="width:0em;display:inline-block"></div>*&nbsp;@author&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Priologic&nbsp;Software,&nbsp;info@easyrtc.com
<a name="line7"></a><div class="linenumber">7</div><div style="width:0em;display:inline-block"></div>*&nbsp;@copyright&nbsp;&nbsp;&nbsp;Copyright&nbsp;2016&nbsp;Priologic&nbsp;Software.&nbsp;All&nbsp;rights&nbsp;reserved.
<a name="line8"></a><div class="linenumber">8</div><div style="width:0em;display:inline-block"></div>*&nbsp;@license&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BSD&nbsp;v2,&nbsp;see&nbsp;LICENSE&nbsp;file&nbsp;in&nbsp;module&nbsp;root&nbsp;folder.
<a name="line9"></a><div class="linenumber">9</div><div style="width:0em;display:inline-block"></div>*/
<a name="line10"></a><div class="linenumber">10</div>
<a name="line11"></a><div class="linenumber">11</div><div style="width:0em;display:inline-block"></div>var&nbsp;util&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;require("util");&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;General&nbsp;utility&nbsp;functions&nbsp;core&nbsp;module
<a name="line12"></a><div class="linenumber">12</div><div style="width:0em;display:inline-block"></div>var&nbsp;_&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;require("underscore");&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;General&nbsp;utility&nbsp;functions&nbsp;external&nbsp;module
<a name="line13"></a><div class="linenumber">13</div><div style="width:0em;display:inline-block"></div>var&nbsp;g&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;require("./general_util");&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;General&nbsp;utility&nbsp;functions&nbsp;local&nbsp;module
<a name="line14"></a><div class="linenumber">14</div>
<a name="line15"></a><div class="linenumber">15</div><div style="width:0em;display:inline-block"></div>var&nbsp;async&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;require("async");&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Asynchronous&nbsp;calls&nbsp;external&nbsp;module
<a name="line16"></a><div class="linenumber">16</div>
<a name="line17"></a><div class="linenumber">17</div><div style="width:0em;display:inline-block"></div>var&nbsp;pub&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;require("./easyrtc_public_obj");&nbsp;&nbsp;//&nbsp;EasyRTC&nbsp;public&nbsp;object
<a name="line18"></a><div class="linenumber">18</div>
<a name="line19"></a><div class="linenumber">19</div><div style="width:0em;display:inline-block"></div>/**
<a name="line20"></a><div class="linenumber">20</div><div style="width:0em;display:inline-block"></div>*&nbsp;Event&nbsp;listeners&nbsp;used&nbsp;by&nbsp;EasyRTC.&nbsp;Many&nbsp;of&nbsp;these&nbsp;can&nbsp;be&nbsp;overridden&nbsp;using&nbsp;server&nbsp;options.&nbsp;The&nbsp;interfaces&nbsp;should&nbsp;be&nbsp;used&nbsp;as&nbsp;a&nbsp;guide&nbsp;for&nbsp;creating&nbsp;new&nbsp;listeners.
<a name="line21"></a><div class="linenumber">21</div><div style="width:0em;display:inline-block"></div>*
<a name="line22"></a><div class="linenumber">22</div><div style="width:0em;display:inline-block"></div>*&nbsp;@class&nbsp;
<a name="line23"></a><div class="linenumber">23</div><div style="width:0em;display:inline-block"></div>*/
<a name="line24"></a><div class="linenumber">24</div><div style="width:0em;display:inline-block"></div>var&nbsp;eventListener&nbsp;=&nbsp;module.exports;
<a name="line25"></a><div class="linenumber">25</div>
<a name="line26"></a><div class="linenumber">26</div><div style="width:0em;display:inline-block"></div>/**
<a name="line27"></a><div class="linenumber">27</div><div style="width:0em;display:inline-block"></div>*&nbsp;Default&nbsp;listener&nbsp;for&nbsp;event&nbsp;"authenticate".&nbsp;This&nbsp;event&nbsp;is&nbsp;called&nbsp;as&nbsp;part&nbsp;of&nbsp;the&nbsp;authentication&nbsp;process.&nbsp;To&nbsp;deny&nbsp;authentication,&nbsp;call&nbsp;the&nbsp;next()&nbsp;with&nbsp;an&nbsp;Error.&nbsp;By&nbsp;default&nbsp;everyone&nbsp;gets&nbsp;in!
<a name="line28"></a><div class="linenumber">28</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line29"></a><div class="linenumber">29</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;socket&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Socket.io&nbsp;socket&nbsp;object.&nbsp;References&nbsp;the&nbsp;individual&nbsp;connection&nbsp;socket.&nbsp;
<a name="line30"></a><div class="linenumber">30</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{String}&nbsp;easyrtcid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Unique&nbsp;identifier&nbsp;for&nbsp;an&nbsp;EasyRTC&nbsp;connection.
<a name="line31"></a><div class="linenumber">31</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;appName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Application&nbsp;name&nbsp;which&nbsp;uniquely&nbsp;identifies&nbsp;it&nbsp;on&nbsp;the&nbsp;server.
<a name="line32"></a><div class="linenumber">32</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?String}&nbsp;username&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Username&nbsp;to&nbsp;assign&nbsp;to&nbsp;the&nbsp;connection.
<a name="line33"></a><div class="linenumber">33</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?*}&nbsp;credential&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Credential&nbsp;for&nbsp;the&nbsp;connection.&nbsp;Can&nbsp;be&nbsp;any&nbsp;JSONable&nbsp;object.
<a name="line34"></a><div class="linenumber">34</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;easyrtcAuthMessage&nbsp;Message&nbsp;object&nbsp;containing&nbsp;the&nbsp;complete&nbsp;authentication&nbsp;message&nbsp;sent&nbsp;by&nbsp;the&nbsp;connection.
<a name="line35"></a><div class="linenumber">35</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line36"></a><div class="linenumber">36</div><div style="width:0em;display:inline-block"></div>*/
<a name="line37"></a><div class="linenumber">37</div><div style="width:0em;display:inline-block"></div>eventListener.onAuthenticate&nbsp;=&nbsp;function(socket,&nbsp;easyrtcid,&nbsp;appName,&nbsp;username,&nbsp;credential,&nbsp;easyrtcAuthMessage,&nbsp;next)&nbsp;{
<a name="line38"></a><div class="linenumber">38</div><div style="width:2em;display:inline-block"></div>next(null);
<a name="line39"></a><div class="linenumber">39</div><div style="width:0em;display:inline-block"></div>};
<a name="line40"></a><div class="linenumber">40</div>
<a name="line41"></a><div class="linenumber">41</div>
<a name="line42"></a><div class="linenumber">42</div><div style="width:0em;display:inline-block"></div>/**
<a name="line43"></a><div class="linenumber">43</div><div style="width:0em;display:inline-block"></div>*&nbsp;Default&nbsp;listener&nbsp;for&nbsp;event&nbsp;"authenticated".&nbsp;This&nbsp;event&nbsp;is&nbsp;called&nbsp;after&nbsp;a&nbsp;connection&nbsp;is&nbsp;authenticated&nbsp;and&nbsp;the&nbsp;connection&nbsp;object&nbsp;is&nbsp;generated&nbsp;and&nbsp;requested&nbsp;rooms&nbsp;are&nbsp;joined.&nbsp;Call&nbsp;next(err)&nbsp;to&nbsp;continue&nbsp;the&nbsp;connection&nbsp;procedure.
<a name="line44"></a><div class="linenumber">44</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line45"></a><div class="linenumber">45</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;connectionObj&nbsp;&nbsp;EasyRTC&nbsp;connection&nbsp;object.&nbsp;Contains&nbsp;methods&nbsp;used&nbsp;for&nbsp;identifying&nbsp;and&nbsp;managing&nbsp;a&nbsp;connection.
<a name="line46"></a><div class="linenumber">46</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line47"></a><div class="linenumber">47</div><div style="width:0em;display:inline-block"></div>*/
<a name="line48"></a><div class="linenumber">48</div><div style="width:0em;display:inline-block"></div>eventListener.onAuthenticated&nbsp;=&nbsp;function(connectionObj,&nbsp;next)&nbsp;{
<a name="line49"></a><div class="linenumber">49</div><div style="width:2em;display:inline-block"></div>next(null);
<a name="line50"></a><div class="linenumber">50</div><div style="width:0em;display:inline-block"></div>};
<a name="line51"></a><div class="linenumber">51</div>
<a name="line52"></a><div class="linenumber">52</div>
<a name="line53"></a><div class="linenumber">53</div><div style="width:0em;display:inline-block"></div>/**
<a name="line54"></a><div class="linenumber">54</div><div style="width:0em;display:inline-block"></div>*&nbsp;Default&nbsp;listener&nbsp;for&nbsp;event&nbsp;"connection".&nbsp;This&nbsp;event&nbsp;is&nbsp;called&nbsp;when&nbsp;socket.io&nbsp;accepts&nbsp;a&nbsp;new&nbsp;connection.
<a name="line55"></a><div class="linenumber">55</div><div style="width:0em;display:inline-block"></div>*
<a name="line56"></a><div class="linenumber">56</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;socket&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Socket.io&nbsp;socket&nbsp;object.&nbsp;References&nbsp;the&nbsp;individual&nbsp;connection&nbsp;socket.&nbsp;
<a name="line57"></a><div class="linenumber">57</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{String}&nbsp;easyrtcid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Unique&nbsp;identifier&nbsp;for&nbsp;an&nbsp;EasyRTC&nbsp;connection.
<a name="line58"></a><div class="linenumber">58</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line59"></a><div class="linenumber">59</div><div style="width:0em;display:inline-block"></div>*/
<a name="line60"></a><div class="linenumber">60</div><div style="width:0em;display:inline-block"></div>eventListener.onConnection&nbsp;=&nbsp;function(socket,&nbsp;easyrtcid,&nbsp;next){
<a name="line61"></a><div class="linenumber">61</div><div style="width:2em;display:inline-block"></div>var&nbsp;connectionObj&nbsp;=&nbsp;{};&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;prepare&nbsp;variables&nbsp;to&nbsp;house&nbsp;the&nbsp;connection&nbsp;object
<a name="line62"></a><div class="linenumber">62</div>
<a name="line63"></a><div class="linenumber">63</div><div style="width:2em;display:inline-block"></div>//&nbsp;Initially&nbsp;upon&nbsp;a&nbsp;connection,&nbsp;we&nbsp;are&nbsp;only&nbsp;concerned&nbsp;with&nbsp;receiving&nbsp;an&nbsp;easyrtcAuth&nbsp;message
<a name="line64"></a><div class="linenumber">64</div><div style="width:2em;display:inline-block"></div>socket.on("easyrtcAuth",&nbsp;function(msg,&nbsp;socketCallback)&nbsp;{
<a name="line65"></a><div class="linenumber">65</div>
<a name="line66"></a><div class="linenumber">66</div><div style="width:4em;display:inline-block"></div>if&nbsp;(pub.getOption("logMessagesEnable"))&nbsp;{
<a name="line67"></a><div class="linenumber">67</div><div style="width:6em;display:inline-block"></div>try&nbsp;{
<a name="line68"></a><div class="linenumber">68</div><div style="width:8em;display:inline-block"></div>pub.util.logDebug("["+easyrtcid+"]&nbsp;Incoming&nbsp;socket.io&nbsp;message:&nbsp;["+JSON.stringify(msg)+"]");
<a name="line69"></a><div class="linenumber">69</div><div style="width:6em;display:inline-block"></div>}
<a name="line70"></a><div class="linenumber">70</div><div style="width:6em;display:inline-block"></div>catch(err)&nbsp;{
<a name="line71"></a><div class="linenumber">71</div><div style="width:8em;display:inline-block"></div>pub.util.logDebug("["+easyrtcid+"]&nbsp;Incoming&nbsp;socket.io&nbsp;message");
<a name="line72"></a><div class="linenumber">72</div><div style="width:6em;display:inline-block"></div>}
<a name="line73"></a><div class="linenumber">73</div><div style="width:4em;display:inline-block"></div>}
<a name="line74"></a><div class="linenumber">74</div>
<a name="line75"></a><div class="linenumber">75</div><div style="width:4em;display:inline-block"></div>pub.events.emit("easyrtcAuth",&nbsp;socket,&nbsp;easyrtcid,&nbsp;msg,&nbsp;socketCallback,&nbsp;function(err,&nbsp;newConnectionObj){
<a name="line76"></a><div class="linenumber">76</div><div style="width:6em;display:inline-block"></div>if(err){
<a name="line77"></a><div class="linenumber">77</div><div style="width:8em;display:inline-block"></div>pub.util.logError("["+easyrtcid+"]&nbsp;Unhandled&nbsp;easyrtcCmd&nbsp;listener&nbsp;error.",&nbsp;err);
<a name="line78"></a><div class="linenumber">78</div><div style="width:8em;display:inline-block"></div>return;
<a name="line79"></a><div class="linenumber">79</div><div style="width:6em;display:inline-block"></div>}
<a name="line80"></a><div class="linenumber">80</div>
<a name="line81"></a><div class="linenumber">81</div><div style="width:6em;display:inline-block"></div>connectionObj&nbsp;=&nbsp;newConnectionObj;
<a name="line82"></a><div class="linenumber">82</div><div style="width:4em;display:inline-block"></div>});
<a name="line83"></a><div class="linenumber">83</div><div style="width:2em;display:inline-block"></div>});
<a name="line84"></a><div class="linenumber">84</div>
<a name="line85"></a><div class="linenumber">85</div><div style="width:2em;display:inline-block"></div>pub.util.logDebug("Running&nbsp;func&nbsp;'onConnection'");
<a name="line86"></a><div class="linenumber">86</div><div style="width:2em;display:inline-block"></div>next(null);
<a name="line87"></a><div class="linenumber">87</div><div style="width:0em;display:inline-block"></div>};
<a name="line88"></a><div class="linenumber">88</div>
<a name="line89"></a><div class="linenumber">89</div>
<a name="line90"></a><div class="linenumber">90</div><div style="width:0em;display:inline-block"></div>/**
<a name="line91"></a><div class="linenumber">91</div><div style="width:0em;display:inline-block"></div>*&nbsp;Default&nbsp;listener&nbsp;for&nbsp;event&nbsp;"disconnect".&nbsp;This&nbsp;event&nbsp;is&nbsp;called&nbsp;when&nbsp;socket.io&nbsp;detects&nbsp;a&nbsp;disconnection.&nbsp;Disconnections&nbsp;can&nbsp;occur&nbsp;due&nbsp;to&nbsp;either&nbsp;side&nbsp;purposefully&nbsp;dropping&nbsp;a&nbsp;connection,&nbsp;network&nbsp;disconnection,&nbsp;or&nbsp;time&nbsp;out.&nbsp;
<a name="line92"></a><div class="linenumber">92</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line93"></a><div class="linenumber">93</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;connectionObj&nbsp;&nbsp;EasyRTC&nbsp;connection&nbsp;object.&nbsp;Contains&nbsp;methods&nbsp;used&nbsp;for&nbsp;identifying&nbsp;and&nbsp;managing&nbsp;a&nbsp;connection.
<a name="line94"></a><div class="linenumber">94</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line95"></a><div class="linenumber">95</div><div style="width:0em;display:inline-block"></div>*/
<a name="line96"></a><div class="linenumber">96</div><div style="width:0em;display:inline-block"></div>eventListener.onDisconnect&nbsp;=&nbsp;function(connectionObj,&nbsp;next){
<a name="line97"></a><div class="linenumber">97</div><div style="width:2em;display:inline-block"></div>pub.util.logDebug("Running&nbsp;func&nbsp;'onDisconnect'");
<a name="line98"></a><div class="linenumber">98</div>
<a name="line99"></a><div class="linenumber">99</div><div style="width:2em;display:inline-block"></div>async.waterfall([
<a name="line100"></a><div class="linenumber">100</div><div style="width:4em;display:inline-block"></div>function(asyncCallback)&nbsp;{
<a name="line101"></a><div class="linenumber">101</div><div style="width:6em;display:inline-block"></div>//&nbsp;Get&nbsp;array&nbsp;of&nbsp;rooms
<a name="line102"></a><div class="linenumber">102</div><div style="width:6em;display:inline-block"></div>connectionObj.getRoomNames(asyncCallback);
<a name="line103"></a><div class="linenumber">103</div><div style="width:4em;display:inline-block"></div>},
<a name="line104"></a><div class="linenumber">104</div><div style="width:4em;display:inline-block"></div>function(roomNames,&nbsp;asyncCallback)&nbsp;{
<a name="line105"></a><div class="linenumber">105</div><div style="width:6em;display:inline-block"></div>//&nbsp;leave&nbsp;all&nbsp;rooms
<a name="line106"></a><div class="linenumber">106</div><div style="width:6em;display:inline-block"></div>async.each(roomNames,
<a name="line107"></a><div class="linenumber">107</div><div style="width:8em;display:inline-block"></div>function(currentRoomName,&nbsp;asyncEachCallback)&nbsp;{
<a name="line108"></a><div class="linenumber">108</div><div style="width:10em;display:inline-block"></div>pub.events.emit("roomLeave",&nbsp;connectionObj,&nbsp;currentRoomName,&nbsp;function(err){asyncEachCallback(null);});
<a name="line109"></a><div class="linenumber">109</div><div style="width:8em;display:inline-block"></div>},
<a name="line110"></a><div class="linenumber">110</div><div style="width:8em;display:inline-block"></div>function(err){
<a name="line111"></a><div class="linenumber">111</div><div style="width:10em;display:inline-block"></div>asyncCallback(null);
<a name="line112"></a><div class="linenumber">112</div><div style="width:8em;display:inline-block"></div>}
<a name="line113"></a><div class="linenumber">113</div><div style="width:6em;display:inline-block"></div>);
<a name="line114"></a><div class="linenumber">114</div><div style="width:4em;display:inline-block"></div>},
<a name="line115"></a><div class="linenumber">115</div><div style="width:4em;display:inline-block"></div>function(asyncCallback)&nbsp;{
<a name="line116"></a><div class="linenumber">116</div><div style="width:6em;display:inline-block"></div>//&nbsp;log&nbsp;all&nbsp;connections&nbsp;as&nbsp;ended
<a name="line117"></a><div class="linenumber">117</div><div style="width:6em;display:inline-block"></div>pub.util.logDebug("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;Disconnected");
<a name="line118"></a><div class="linenumber">118</div><div style="width:6em;display:inline-block"></div>connectionObj.removeConnection(asyncCallback);
<a name="line119"></a><div class="linenumber">119</div><div style="width:4em;display:inline-block"></div>}
<a name="line120"></a><div class="linenumber">120</div><div style="width:2em;display:inline-block"></div>],&nbsp;function(err)&nbsp;{
<a name="line121"></a><div class="linenumber">121</div><div style="width:4em;display:inline-block"></div>next(null);
<a name="line122"></a><div class="linenumber">122</div><div style="width:2em;display:inline-block"></div>});
<a name="line123"></a><div class="linenumber">123</div>
<a name="line124"></a><div class="linenumber">124</div><div style="width:2em;display:inline-block"></div>next(null);
<a name="line125"></a><div class="linenumber">125</div><div style="width:0em;display:inline-block"></div>};
<a name="line126"></a><div class="linenumber">126</div>
<a name="line127"></a><div class="linenumber">127</div>
<a name="line128"></a><div class="linenumber">128</div><div style="width:0em;display:inline-block"></div>/**
<a name="line129"></a><div class="linenumber">129</div><div style="width:0em;display:inline-block"></div>*&nbsp;Default&nbsp;listener&nbsp;for&nbsp;event&nbsp;"easyrtcAuth".&nbsp;This&nbsp;event&nbsp;is&nbsp;fired&nbsp;when&nbsp;an&nbsp;incoming&nbsp;'easyrtcAuth'&nbsp;message&nbsp;is&nbsp;received&nbsp;from&nbsp;a&nbsp;client.
<a name="line130"></a><div class="linenumber">130</div><div style="width:0em;display:inline-block"></div>*
<a name="line131"></a><div class="linenumber">131</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;&nbsp;&nbsp;&nbsp;socket&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Socket.io&nbsp;socket&nbsp;object.&nbsp;References&nbsp;the&nbsp;individual&nbsp;connection&nbsp;socket.
<a name="line132"></a><div class="linenumber">132</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{String}&nbsp;&nbsp;&nbsp;&nbsp;easyrtcid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Unique&nbsp;identifier&nbsp;for&nbsp;an&nbsp;EasyRTC&nbsp;connection.
<a name="line133"></a><div class="linenumber">133</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;&nbsp;&nbsp;&nbsp;msg&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Message&nbsp;object&nbsp;which&nbsp;contains&nbsp;the&nbsp;full&nbsp;message&nbsp;from&nbsp;a&nbsp;client;&nbsp;this&nbsp;can&nbsp;include&nbsp;the&nbsp;standard&nbsp;msgType&nbsp;and&nbsp;msgData&nbsp;fields.
<a name="line134"></a><div class="linenumber">134</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Function}&nbsp;&nbsp;socketCallback&nbsp;Socket.io&nbsp;callback&nbsp;function&nbsp;which&nbsp;delivers&nbsp;a&nbsp;response&nbsp;to&nbsp;a&nbsp;socket.&nbsp;Expects&nbsp;a&nbsp;single&nbsp;parameter&nbsp;(msg).
<a name="line135"></a><div class="linenumber">135</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Function}&nbsp;&nbsp;callback&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Callback&nbsp;to&nbsp;call&nbsp;upon&nbsp;completion.&nbsp;Delivers&nbsp;parameter&nbsp;(err,&nbsp;connectionObj).
<a name="line136"></a><div class="linenumber">136</div><div style="width:0em;display:inline-block"></div>*/
<a name="line137"></a><div class="linenumber">137</div><div style="width:0em;display:inline-block"></div>eventListener.onEasyrtcAuth&nbsp;=&nbsp;function(socket,&nbsp;easyrtcid,&nbsp;msg,&nbsp;socketCallback,&nbsp;callback){
<a name="line138"></a><div class="linenumber">138</div><div style="width:2em;display:inline-block"></div>pub.util.logDebug("["+easyrtcid+"]&nbsp;Running&nbsp;func&nbsp;'onEasyrtcAuth'");
<a name="line139"></a><div class="linenumber">139</div>
<a name="line140"></a><div class="linenumber">140</div><div style="width:2em;display:inline-block"></div>var&nbsp;appObj,&nbsp;connectionObj,&nbsp;sessionObj;&nbsp;&nbsp;//&nbsp;prepare&nbsp;variables&nbsp;to&nbsp;house&nbsp;the&nbsp;application,&nbsp;connection,&nbsp;and&nbsp;session&nbsp;objects
<a name="line141"></a><div class="linenumber">141</div>
<a name="line142"></a><div class="linenumber">142</div><div style="width:2em;display:inline-block"></div>var&nbsp;tokenMsg&nbsp;=&nbsp;{
<a name="line143"></a><div class="linenumber">143</div><div style="width:4em;display:inline-block"></div>msgType:&nbsp;"token",
<a name="line144"></a><div class="linenumber">144</div><div style="width:4em;display:inline-block"></div>msgData:{}
<a name="line145"></a><div class="linenumber">145</div><div style="width:2em;display:inline-block"></div>};
<a name="line146"></a><div class="linenumber">146</div>
<a name="line147"></a><div class="linenumber">147</div><div style="width:2em;display:inline-block"></div>var&nbsp;appName;
<a name="line148"></a><div class="linenumber">148</div><div style="width:2em;display:inline-block"></div>var&nbsp;newAppName&nbsp;=&nbsp;(_.isObject(msg.msgData)&nbsp;&amp;&amp;_.isString(msg.msgData.applicationName))&nbsp;?&nbsp;msg.msgData.applicationName&nbsp;:&nbsp;pub.getOption("appDefaultName");
<a name="line149"></a><div class="linenumber">149</div>
<a name="line150"></a><div class="linenumber">150</div><div style="width:2em;display:inline-block"></div>//&nbsp;Ensure&nbsp;socketCallback&nbsp;is&nbsp;present
<a name="line151"></a><div class="linenumber">151</div><div style="width:2em;display:inline-block"></div>if(!_.isFunction(socketCallback))&nbsp;{
<a name="line152"></a><div class="linenumber">152</div><div style="width:4em;display:inline-block"></div>pub.util.logWarning("["+easyrtcid+"]&nbsp;EasyRTC&nbsp;Auth&nbsp;message&nbsp;received&nbsp;with&nbsp;no&nbsp;callback.&nbsp;Disconnecting&nbsp;socket.",&nbsp;msg);
<a name="line153"></a><div class="linenumber">153</div><div style="width:4em;display:inline-block"></div>try{socket.disconnect();}catch(e){}
<a name="line154"></a><div class="linenumber">154</div><div style="width:4em;display:inline-block"></div>return;
<a name="line155"></a><div class="linenumber">155</div><div style="width:2em;display:inline-block"></div>}
<a name="line156"></a><div class="linenumber">156</div>
<a name="line157"></a><div class="linenumber">157</div><div style="width:2em;display:inline-block"></div>//&nbsp;Only&nbsp;accept&nbsp;authenticate&nbsp;message
<a name="line158"></a><div class="linenumber">158</div><div style="width:2em;display:inline-block"></div>if(!_.isObject(msg)&nbsp;||&nbsp;!_.isString(msg.msgType)&nbsp;||&nbsp;msg.msgType&nbsp;!=&nbsp;"authenticate")&nbsp;{
<a name="line159"></a><div class="linenumber">159</div><div style="width:4em;display:inline-block"></div>pub.util.logWarning("["+easyrtcid+"]&nbsp;EasyRTC&nbsp;Auth&nbsp;message&nbsp;received&nbsp;without&nbsp;msgType&nbsp;of&nbsp;'authenticate'.&nbsp;Disconnecting&nbsp;socket.",&nbsp;msg);
<a name="line160"></a><div class="linenumber">160</div><div style="width:4em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;pub.util.getErrorMsg("LOGIN_BAD_AUTH"),&nbsp;appObj);
<a name="line161"></a><div class="linenumber">161</div><div style="width:4em;display:inline-block"></div>try{socket.disconnect();}catch(e){}
<a name="line162"></a><div class="linenumber">162</div><div style="width:4em;display:inline-block"></div>return;
<a name="line163"></a><div class="linenumber">163</div><div style="width:2em;display:inline-block"></div>}
<a name="line164"></a><div class="linenumber">164</div>
<a name="line165"></a><div class="linenumber">165</div><div style="width:2em;display:inline-block"></div>//&nbsp;Check&nbsp;msg&nbsp;structure.
<a name="line166"></a><div class="linenumber">166</div><div style="width:2em;display:inline-block"></div>if(!_.isObject(msg.msgData)
<a name="line167"></a><div class="linenumber">167</div><div style="width:4em;display:inline-block"></div>||&nbsp;!_.isString(msg.msgData.apiVersion)
<a name="line168"></a><div class="linenumber">168</div><div style="width:4em;display:inline-block"></div>||&nbsp;(msg.msgData.roomJoin&nbsp;!==&nbsp;undefined&nbsp;&amp;&amp;&nbsp;!_.isObject(msg.msgData.roomJoin))
<a name="line169"></a><div class="linenumber">169</div><div style="width:2em;display:inline-block"></div>)&nbsp;{
<a name="line170"></a><div class="linenumber">170</div><div style="width:4em;display:inline-block"></div>pub.util.logWarning("["+easyrtcid+"]&nbsp;EasyRTC&nbsp;Auth&nbsp;message&nbsp;received&nbsp;with&nbsp;improper&nbsp;msgData.&nbsp;Disconnecting&nbsp;socket.",&nbsp;msg);
<a name="line171"></a><div class="linenumber">171</div><div style="width:4em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;pub.util.getErrorMsg("LOGIN_BAD_STRUCTURE"),&nbsp;appObj);
<a name="line172"></a><div class="linenumber">172</div><div style="width:4em;display:inline-block"></div>try{socket.disconnect();}catch(e){}
<a name="line173"></a><div class="linenumber">173</div><div style="width:4em;display:inline-block"></div>return;
<a name="line174"></a><div class="linenumber">174</div><div style="width:2em;display:inline-block"></div>}
<a name="line175"></a><div class="linenumber">175</div>
<a name="line176"></a><div class="linenumber">176</div><div style="width:2em;display:inline-block"></div>async.waterfall([
<a name="line177"></a><div class="linenumber">177</div><div style="width:4em;display:inline-block"></div>function(asyncCallback)&nbsp;{
<a name="line178"></a><div class="linenumber">178</div><div style="width:6em;display:inline-block"></div>//&nbsp;Check&nbsp;message&nbsp;structure
<a name="line179"></a><div class="linenumber">179</div><div style="width:6em;display:inline-block"></div>pub.util.isValidIncomingMessage("easyrtcAuth",&nbsp;msg,&nbsp;null,&nbsp;asyncCallback);
<a name="line180"></a><div class="linenumber">180</div><div style="width:4em;display:inline-block"></div>},
<a name="line181"></a><div class="linenumber">181</div>
<a name="line182"></a><div class="linenumber">182</div><div style="width:4em;display:inline-block"></div>function(isMsgValid,&nbsp;msgErrorCode,&nbsp;asyncCallback)&nbsp;{
<a name="line183"></a><div class="linenumber">183</div><div style="width:6em;display:inline-block"></div>//&nbsp;If&nbsp;message&nbsp;structure&nbsp;is&nbsp;invalid,&nbsp;send&nbsp;error,&nbsp;disconnect&nbsp;socket,&nbsp;and&nbsp;write&nbsp;to&nbsp;log
<a name="line184"></a><div class="linenumber">184</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!isMsgValid)&nbsp;{
<a name="line185"></a><div class="linenumber">185</div><div style="width:8em;display:inline-block"></div>try{
<a name="line186"></a><div class="linenumber">186</div><div style="width:10em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;pub.util.getErrorMsg(msgErrorCode),&nbsp;appObj);
<a name="line187"></a><div class="linenumber">187</div><div style="width:10em;display:inline-block"></div>socket.disconnect();
<a name="line188"></a><div class="linenumber">188</div><div style="width:8em;display:inline-block"></div>}catch(e){}
<a name="line189"></a><div class="linenumber">189</div><div style="width:8em;display:inline-block"></div>pub.util.logWarning("["+easyrtcid+"]&nbsp;EasyRTC&nbsp;Auth&nbsp;message&nbsp;received&nbsp;with&nbsp;invalid&nbsp;message&nbsp;format&nbsp;["&nbsp;+&nbsp;msgErrorCode&nbsp;+&nbsp;"].&nbsp;Disconnecting&nbsp;socket.",&nbsp;msg);
<a name="line190"></a><div class="linenumber">190</div><div style="width:8em;display:inline-block"></div>callback(new&nbsp;pub.util.ConnectionError("["+easyrtcid+"]&nbsp;EasyRTC&nbsp;Auth&nbsp;message&nbsp;received&nbsp;with&nbsp;invalid&nbsp;message&nbsp;format&nbsp;["&nbsp;+&nbsp;msgErrorCode&nbsp;+&nbsp;"].&nbsp;Disconnecting&nbsp;socket."));
<a name="line191"></a><div class="linenumber">191</div><div style="width:8em;display:inline-block"></div>return;
<a name="line192"></a><div class="linenumber">192</div><div style="width:6em;display:inline-block"></div>}
<a name="line193"></a><div class="linenumber">193</div>
<a name="line194"></a><div class="linenumber">194</div><div style="width:6em;display:inline-block"></div>//&nbsp;Remove&nbsp;any&nbsp;old&nbsp;listeners
<a name="line195"></a><div class="linenumber">195</div><div style="width:6em;display:inline-block"></div>socket.removeAllListeners("easyrtcCmd");
<a name="line196"></a><div class="linenumber">196</div><div style="width:6em;display:inline-block"></div>socket.removeAllListeners("easyrtcMsg");
<a name="line197"></a><div class="linenumber">197</div><div style="width:6em;display:inline-block"></div>socket.removeAllListeners("disconnect");&nbsp;//&nbsp;TODO:&nbsp;Come&nbsp;up&nbsp;with&nbsp;alternative&nbsp;to&nbsp;removing&nbsp;all&nbsp;disconnect&nbsp;listeners
<a name="line198"></a><div class="linenumber">198</div>
<a name="line199"></a><div class="linenumber">199</div><div style="width:6em;display:inline-block"></div>pub.util.logDebug("Emitting&nbsp;Authenticate");
<a name="line200"></a><div class="linenumber">200</div>
<a name="line201"></a><div class="linenumber">201</div><div style="width:6em;display:inline-block"></div>var&nbsp;username&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;(msg.msgData.username&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;?&nbsp;msg.msgData.username&nbsp;&nbsp;:&nbsp;null);
<a name="line202"></a><div class="linenumber">202</div><div style="width:6em;display:inline-block"></div>var&nbsp;credential&nbsp;&nbsp;=&nbsp;(msg.msgData.credential&nbsp;&nbsp;&nbsp;?&nbsp;msg.msgData.credential:&nbsp;null);
<a name="line203"></a><div class="linenumber">203</div>
<a name="line204"></a><div class="linenumber">204</div><div style="width:6em;display:inline-block"></div>//&nbsp;Authenticate&nbsp;is&nbsp;responsible&nbsp;for&nbsp;authenticating&nbsp;the&nbsp;connection
<a name="line205"></a><div class="linenumber">205</div><div style="width:6em;display:inline-block"></div>pub.events.emit("authenticate",&nbsp;socket,&nbsp;easyrtcid,&nbsp;newAppName,&nbsp;username,&nbsp;credential,&nbsp;msg,&nbsp;function(err){
<a name="line206"></a><div class="linenumber">206</div><div style="width:8em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line207"></a><div class="linenumber">207</div><div style="width:10em;display:inline-block"></div>try{
<a name="line208"></a><div class="linenumber">208</div><div style="width:12em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;pub.util.getErrorMsg("LOGIN_BAD_AUTH"),&nbsp;appObj);
<a name="line209"></a><div class="linenumber">209</div><div style="width:12em;display:inline-block"></div>socket.disconnect();
<a name="line210"></a><div class="linenumber">210</div><div style="width:12em;display:inline-block"></div>pub.util.logInfo("["+newAppName+"]["+easyrtcid+"]&nbsp;Authentication&nbsp;denied.&nbsp;Socket&nbsp;disconnected.",&nbsp;err);
<a name="line211"></a><div class="linenumber">211</div><div style="width:10em;display:inline-block"></div>}catch(e){}
<a name="line212"></a><div class="linenumber">212</div><div style="width:8em;display:inline-block"></div>}&nbsp;else&nbsp;{
<a name="line213"></a><div class="linenumber">213</div><div style="width:10em;display:inline-block"></div>asyncCallback(null);
<a name="line214"></a><div class="linenumber">214</div><div style="width:8em;display:inline-block"></div>}
<a name="line215"></a><div class="linenumber">215</div><div style="width:6em;display:inline-block"></div>});
<a name="line216"></a><div class="linenumber">216</div><div style="width:4em;display:inline-block"></div>},
<a name="line217"></a><div class="linenumber">217</div>
<a name="line218"></a><div class="linenumber">218</div><div style="width:4em;display:inline-block"></div>function(asyncCallback)&nbsp;{
<a name="line219"></a><div class="linenumber">219</div><div style="width:6em;display:inline-block"></div>//&nbsp;Check&nbsp;to&nbsp;see&nbsp;if&nbsp;the&nbsp;requested&nbsp;app&nbsp;currently&nbsp;exists.
<a name="line220"></a><div class="linenumber">220</div><div style="width:6em;display:inline-block"></div>pub.isApp(newAppName,&nbsp;asyncCallback);
<a name="line221"></a><div class="linenumber">221</div>
<a name="line222"></a><div class="linenumber">222</div><div style="width:4em;display:inline-block"></div>},
<a name="line223"></a><div class="linenumber">223</div>
<a name="line224"></a><div class="linenumber">224</div><div style="width:4em;display:inline-block"></div>function(isApp,&nbsp;asyncCallback)&nbsp;{
<a name="line225"></a><div class="linenumber">225</div><div style="width:6em;display:inline-block"></div>//&nbsp;If&nbsp;requested&nbsp;app&nbsp;exists,&nbsp;then&nbsp;call&nbsp;it,&nbsp;otherwise&nbsp;create&nbsp;it.
<a name="line226"></a><div class="linenumber">226</div><div style="width:6em;display:inline-block"></div>if&nbsp;(isApp)&nbsp;{
<a name="line227"></a><div class="linenumber">227</div><div style="width:8em;display:inline-block"></div>pub.app(newAppName,&nbsp;asyncCallback);
<a name="line228"></a><div class="linenumber">228</div><div style="width:6em;display:inline-block"></div>}&nbsp;else&nbsp;{
<a name="line229"></a><div class="linenumber">229</div><div style="width:8em;display:inline-block"></div>//&nbsp;if&nbsp;appAutoCreateEnable&nbsp;is&nbsp;true,&nbsp;then&nbsp;a&nbsp;new&nbsp;app&nbsp;will&nbsp;be&nbsp;created&nbsp;using&nbsp;the&nbsp;default&nbsp;options
<a name="line230"></a><div class="linenumber">230</div><div style="width:8em;display:inline-block"></div>if(pub.getOption("appAutoCreateEnable"))&nbsp;{
<a name="line231"></a><div class="linenumber">231</div><div style="width:10em;display:inline-block"></div>pub.createApp(newAppName,&nbsp;null,&nbsp;asyncCallback);
<a name="line232"></a><div class="linenumber">232</div><div style="width:8em;display:inline-block"></div>}&nbsp;else&nbsp;{
<a name="line233"></a><div class="linenumber">233</div><div style="width:10em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;pub.util.getErrorMsg("LOGIN_APP_AUTH_FAIL"),&nbsp;appObj);
<a name="line234"></a><div class="linenumber">234</div><div style="width:10em;display:inline-block"></div>socket.disconnect();
<a name="line235"></a><div class="linenumber">235</div><div style="width:10em;display:inline-block"></div>pub.util.logWarning("["&nbsp;+&nbsp;easyrtcid&nbsp;+&nbsp;"]&nbsp;Authentication&nbsp;failed.&nbsp;Requested&nbsp;application&nbsp;not&nbsp;found&nbsp;["&nbsp;+&nbsp;newAppName&nbsp;+&nbsp;"].&nbsp;Socket&nbsp;disconnected.");
<a name="line236"></a><div class="linenumber">236</div><div style="width:8em;display:inline-block"></div>}
<a name="line237"></a><div class="linenumber">237</div><div style="width:6em;display:inline-block"></div>}
<a name="line238"></a><div class="linenumber">238</div><div style="width:4em;display:inline-block"></div>},
<a name="line239"></a><div class="linenumber">239</div>
<a name="line240"></a><div class="linenumber">240</div><div style="width:4em;display:inline-block"></div>function(newAppObj,&nbsp;asyncCallback)&nbsp;{
<a name="line241"></a><div class="linenumber">241</div><div style="width:6em;display:inline-block"></div>//&nbsp;Now&nbsp;that&nbsp;we&nbsp;have&nbsp;an&nbsp;app,&nbsp;we&nbsp;can&nbsp;use&nbsp;it
<a name="line242"></a><div class="linenumber">242</div><div style="width:6em;display:inline-block"></div>appObj&nbsp;=&nbsp;newAppObj;
<a name="line243"></a><div class="linenumber">243</div><div style="width:6em;display:inline-block"></div>appName&nbsp;=&nbsp;appObj.getAppName();
<a name="line244"></a><div class="linenumber">244</div>
<a name="line245"></a><div class="linenumber">245</div><div style="width:6em;display:inline-block"></div>appObj.isConnected(easyrtcid,&nbsp;asyncCallback);
<a name="line246"></a><div class="linenumber">246</div><div style="width:4em;display:inline-block"></div>},
<a name="line247"></a><div class="linenumber">247</div>
<a name="line248"></a><div class="linenumber">248</div><div style="width:4em;display:inline-block"></div>function(isConnected,&nbsp;asyncCallback)&nbsp;{
<a name="line249"></a><div class="linenumber">249</div><div style="width:6em;display:inline-block"></div>//&nbsp;If&nbsp;socket&nbsp;has&nbsp;previously&nbsp;connected,&nbsp;disconnect&nbsp;them.
<a name="line250"></a><div class="linenumber">250</div><div style="width:6em;display:inline-block"></div>if&nbsp;(isConnected){
<a name="line251"></a><div class="linenumber">251</div><div style="width:8em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;pub.util.getErrorMsg("LOGIN_APP_AUTH_FAIL"),&nbsp;appObj);
<a name="line252"></a><div class="linenumber">252</div><div style="width:8em;display:inline-block"></div>socket.disconnect();
<a name="line253"></a><div class="linenumber">253</div><div style="width:8em;display:inline-block"></div>pub.util.logWarning("["&nbsp;+&nbsp;easyrtcid&nbsp;+&nbsp;"]&nbsp;Authentication&nbsp;failed.&nbsp;Already&nbsp;connected.&nbsp;Socket&nbsp;disconnected.");
<a name="line254"></a><div class="linenumber">254</div><div style="width:8em;display:inline-block"></div>return;
<a name="line255"></a><div class="linenumber">255</div><div style="width:6em;display:inline-block"></div>}
<a name="line256"></a><div class="linenumber">256</div>
<a name="line257"></a><div class="linenumber">257</div><div style="width:6em;display:inline-block"></div>//&nbsp;if&nbsp;roomJoin&nbsp;is&nbsp;present&nbsp;in&nbsp;message,&nbsp;check&nbsp;the&nbsp;room&nbsp;names
<a name="line258"></a><div class="linenumber">258</div><div style="width:6em;display:inline-block"></div>if&nbsp;(msg.msgData.roomJoin)&nbsp;{
<a name="line259"></a><div class="linenumber">259</div><div style="width:8em;display:inline-block"></div>for&nbsp;(var&nbsp;currentRoomName&nbsp;in&nbsp;msg.msgData.roomJoin)&nbsp;{
<a name="line260"></a><div class="linenumber">260</div><div style="width:10em;display:inline-block"></div>if&nbsp;(!_.isString(currentRoomName)&nbsp;||&nbsp;!appObj.getOption("roomNameRegExp").test(currentRoomName))&nbsp;{
<a name="line261"></a><div class="linenumber">261</div><div style="width:12em;display:inline-block"></div>pub.events.emit("emitReturnError",&nbsp;socketCallback,&nbsp;"MSG_REJECT_TARGET_ROOM",&nbsp;pub.util.nextToNowhere);
<a name="line262"></a><div class="linenumber">262</div><div style="width:12em;display:inline-block"></div>pub.util.logInfo("["&nbsp;+&nbsp;easyrtcid&nbsp;+&nbsp;"]&nbsp;Authentication&nbsp;failed.&nbsp;Requested&nbsp;room&nbsp;name&nbsp;not&nbsp;allowed&nbsp;["&nbsp;+&nbsp;currentRoomName&nbsp;+&nbsp;"].");
<a name="line263"></a><div class="linenumber">263</div><div style="width:12em;display:inline-block"></div>return;
<a name="line264"></a><div class="linenumber">264</div><div style="width:10em;display:inline-block"></div>}
<a name="line265"></a><div class="linenumber">265</div><div style="width:8em;display:inline-block"></div>}
<a name="line266"></a><div class="linenumber">266</div><div style="width:6em;display:inline-block"></div>}
<a name="line267"></a><div class="linenumber">267</div><div style="width:6em;display:inline-block"></div>asyncCallback(null);
<a name="line268"></a><div class="linenumber">268</div><div style="width:4em;display:inline-block"></div>},
<a name="line269"></a><div class="linenumber">269</div>
<a name="line270"></a><div class="linenumber">270</div><div style="width:4em;display:inline-block"></div>function(asyncCallback)&nbsp;{
<a name="line271"></a><div class="linenumber">271</div><div style="width:6em;display:inline-block"></div>//&nbsp;Create&nbsp;the&nbsp;connection&nbsp;object
<a name="line272"></a><div class="linenumber">272</div><div style="width:6em;display:inline-block"></div>appObj.createConnection(easyrtcid,&nbsp;socket.id,&nbsp;asyncCallback);
<a name="line273"></a><div class="linenumber">273</div><div style="width:4em;display:inline-block"></div>},
<a name="line274"></a><div class="linenumber">274</div>
<a name="line275"></a><div class="linenumber">275</div>
<a name="line276"></a><div class="linenumber">276</div><div style="width:4em;display:inline-block"></div>function(newConnectionObj,&nbsp;asyncCallback)&nbsp;{
<a name="line277"></a><div class="linenumber">277</div><div style="width:6em;display:inline-block"></div>connectionObj&nbsp;=&nbsp;newConnectionObj;
<a name="line278"></a><div class="linenumber">278</div>
<a name="line279"></a><div class="linenumber">279</div><div style="width:6em;display:inline-block"></div>//&nbsp;Check&nbsp;if&nbsp;there&nbsp;is&nbsp;an&nbsp;easyrtcsid
<a name="line280"></a><div class="linenumber">280</div><div style="width:6em;display:inline-block"></div>if&nbsp;(_.isString(msg.msgData.easyrtcsid))&nbsp;{
<a name="line281"></a><div class="linenumber">281</div><div style="width:8em;display:inline-block"></div>appObj.isSession(msg.msgData.easyrtcsid,&nbsp;function(err,&nbsp;isSession){
<a name="line282"></a><div class="linenumber">282</div><div style="width:10em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line283"></a><div class="linenumber">283</div><div style="width:12em;display:inline-block"></div>asyncCallback(err);
<a name="line284"></a><div class="linenumber">284</div><div style="width:12em;display:inline-block"></div>return;
<a name="line285"></a><div class="linenumber">285</div><div style="width:10em;display:inline-block"></div>}
<a name="line286"></a><div class="linenumber">286</div><div style="width:10em;display:inline-block"></div>if&nbsp;(isSession)&nbsp;{
<a name="line287"></a><div class="linenumber">287</div><div style="width:12em;display:inline-block"></div>appObj.session(msg.msgData.easyrtcsid,&nbsp;asyncCallback);
<a name="line288"></a><div class="linenumber">288</div><div style="width:10em;display:inline-block"></div>}&nbsp;else&nbsp;{
<a name="line289"></a><div class="linenumber">289</div><div style="width:12em;display:inline-block"></div>appObj.createSession(msg.msgData.easyrtcsid,&nbsp;asyncCallback);
<a name="line290"></a><div class="linenumber">290</div><div style="width:10em;display:inline-block"></div>}
<a name="line291"></a><div class="linenumber">291</div><div style="width:8em;display:inline-block"></div>});
<a name="line292"></a><div class="linenumber">292</div><div style="width:6em;display:inline-block"></div>}
<a name="line293"></a><div class="linenumber">293</div><div style="width:6em;display:inline-block"></div>else&nbsp;{
<a name="line294"></a><div class="linenumber">294</div><div style="width:8em;display:inline-block"></div>asyncCallback(null,&nbsp;null);
<a name="line295"></a><div class="linenumber">295</div><div style="width:6em;display:inline-block"></div>}
<a name="line296"></a><div class="linenumber">296</div><div style="width:4em;display:inline-block"></div>},
<a name="line297"></a><div class="linenumber">297</div>
<a name="line298"></a><div class="linenumber">298</div><div style="width:4em;display:inline-block"></div>function(newSessionObj,&nbsp;asyncCallback)&nbsp;{
<a name="line299"></a><div class="linenumber">299</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!newSessionObj)&nbsp;{
<a name="line300"></a><div class="linenumber">300</div><div style="width:8em;display:inline-block"></div>asyncCallback(null);
<a name="line301"></a><div class="linenumber">301</div><div style="width:8em;display:inline-block"></div>return;
<a name="line302"></a><div class="linenumber">302</div><div style="width:6em;display:inline-block"></div>}
<a name="line303"></a><div class="linenumber">303</div><div style="width:6em;display:inline-block"></div>sessionObj&nbsp;=&nbsp;newSessionObj;
<a name="line304"></a><div class="linenumber">304</div><div style="width:6em;display:inline-block"></div>connectionObj.joinSession(sessionObj.getEasyrtcsid(),&nbsp;asyncCallback);
<a name="line305"></a><div class="linenumber">305</div><div style="width:4em;display:inline-block"></div>},
<a name="line306"></a><div class="linenumber">306</div>
<a name="line307"></a><div class="linenumber">307</div><div style="width:4em;display:inline-block"></div>function(asyncCallback)&nbsp;{
<a name="line308"></a><div class="linenumber">308</div><div style="width:6em;display:inline-block"></div>//&nbsp;Set&nbsp;connection&nbsp;as&nbsp;being&nbsp;authenticated&nbsp;(we&nbsp;pre-authenticated)
<a name="line309"></a><div class="linenumber">309</div><div style="width:6em;display:inline-block"></div>connectionObj.setAuthenticated(true,&nbsp;asyncCallback);
<a name="line310"></a><div class="linenumber">310</div><div style="width:4em;display:inline-block"></div>},
<a name="line311"></a><div class="linenumber">311</div>
<a name="line312"></a><div class="linenumber">312</div><div style="width:4em;display:inline-block"></div>function(asyncCallback)&nbsp;{
<a name="line313"></a><div class="linenumber">313</div><div style="width:6em;display:inline-block"></div>//&nbsp;Set&nbsp;username&nbsp;(if&nbsp;defined)
<a name="line314"></a><div class="linenumber">314</div><div style="width:6em;display:inline-block"></div>if&nbsp;(msg.msgData.username&nbsp;!==&nbsp;undefined)&nbsp;{
<a name="line315"></a><div class="linenumber">315</div><div style="width:8em;display:inline-block"></div>connectionObj.setUsername(msg.msgData.username,&nbsp;asyncCallback);
<a name="line316"></a><div class="linenumber">316</div><div style="width:6em;display:inline-block"></div>}&nbsp;else&nbsp;{
<a name="line317"></a><div class="linenumber">317</div><div style="width:8em;display:inline-block"></div>asyncCallback(null);
<a name="line318"></a><div class="linenumber">318</div><div style="width:6em;display:inline-block"></div>}
<a name="line319"></a><div class="linenumber">319</div><div style="width:4em;display:inline-block"></div>},
<a name="line320"></a><div class="linenumber">320</div>
<a name="line321"></a><div class="linenumber">321</div><div style="width:4em;display:inline-block"></div>function(asyncCallback)&nbsp;{
<a name="line322"></a><div class="linenumber">322</div><div style="width:6em;display:inline-block"></div>//&nbsp;Set&nbsp;credential&nbsp;(if&nbsp;defined)
<a name="line323"></a><div class="linenumber">323</div><div style="width:6em;display:inline-block"></div>if&nbsp;(msg.msgData.username&nbsp;!==&nbsp;undefined)&nbsp;{
<a name="line324"></a><div class="linenumber">324</div><div style="width:8em;display:inline-block"></div>connectionObj.setCredential(msg.msgData.credential,&nbsp;asyncCallback);
<a name="line325"></a><div class="linenumber">325</div><div style="width:6em;display:inline-block"></div>}&nbsp;else&nbsp;{
<a name="line326"></a><div class="linenumber">326</div><div style="width:8em;display:inline-block"></div>asyncCallback(null);
<a name="line327"></a><div class="linenumber">327</div><div style="width:6em;display:inline-block"></div>}
<a name="line328"></a><div class="linenumber">328</div><div style="width:4em;display:inline-block"></div>},
<a name="line329"></a><div class="linenumber">329</div>
<a name="line330"></a><div class="linenumber">330</div><div style="width:4em;display:inline-block"></div>function(asyncCallback)&nbsp;{
<a name="line331"></a><div class="linenumber">331</div><div style="width:6em;display:inline-block"></div>//&nbsp;Set&nbsp;presence&nbsp;(if&nbsp;defined)
<a name="line332"></a><div class="linenumber">332</div><div style="width:6em;display:inline-block"></div>if&nbsp;(_.isObject(msg.msgData.setPresence))&nbsp;{
<a name="line333"></a><div class="linenumber">333</div><div style="width:8em;display:inline-block"></div>connectionObj.setPresence(msg.msgData.setPresence,asyncCallback);
<a name="line334"></a><div class="linenumber">334</div><div style="width:6em;display:inline-block"></div>}&nbsp;else&nbsp;{
<a name="line335"></a><div class="linenumber">335</div><div style="width:8em;display:inline-block"></div>asyncCallback(null);
<a name="line336"></a><div class="linenumber">336</div><div style="width:6em;display:inline-block"></div>}
<a name="line337"></a><div class="linenumber">337</div><div style="width:4em;display:inline-block"></div>},
<a name="line338"></a><div class="linenumber">338</div>
<a name="line339"></a><div class="linenumber">339</div><div style="width:4em;display:inline-block"></div>function(asyncCallback)&nbsp;{
<a name="line340"></a><div class="linenumber">340</div><div style="width:6em;display:inline-block"></div>//&nbsp;Join&nbsp;a&nbsp;room.&nbsp;If&nbsp;no&nbsp;rooms&nbsp;are&nbsp;defined&nbsp;than&nbsp;join&nbsp;the&nbsp;default&nbsp;room
<a name="line341"></a><div class="linenumber">341</div><div style="width:6em;display:inline-block"></div>if&nbsp;(_.isObject(msg.msgData.roomJoin)&nbsp;&amp;&amp;&nbsp;!_.isEmpty(msg.msgData.roomJoin))&nbsp;{
<a name="line342"></a><div class="linenumber">342</div><div style="width:8em;display:inline-block"></div>async.each(Object.keys(msg.msgData.roomJoin),&nbsp;function(currentRoomName,&nbsp;roomCallback)&nbsp;{
<a name="line343"></a><div class="linenumber">343</div>
<a name="line344"></a><div class="linenumber">344</div><div style="width:10em;display:inline-block"></div>appObj.isRoom(currentRoomName,&nbsp;function(err,&nbsp;isRoom){
<a name="line345"></a><div class="linenumber">345</div><div style="width:12em;display:inline-block"></div>if(err)&nbsp;{
<a name="line346"></a><div class="linenumber">346</div><div style="width:14em;display:inline-block"></div>roomCallback(err);
<a name="line347"></a><div class="linenumber">347</div><div style="width:14em;display:inline-block"></div>return;
<a name="line348"></a><div class="linenumber">348</div><div style="width:12em;display:inline-block"></div>}
<a name="line349"></a><div class="linenumber">349</div>
<a name="line350"></a><div class="linenumber">350</div><div style="width:12em;display:inline-block"></div>//&nbsp;Set&nbsp;roomParameter&nbsp;map.&nbsp;This&nbsp;may&nbsp;be&nbsp;used&nbsp;by&nbsp;custom&nbsp;listeners.
<a name="line351"></a><div class="linenumber">351</div><div style="width:12em;display:inline-block"></div>var&nbsp;currentRoomParameter;
<a name="line352"></a><div class="linenumber">352</div><div style="width:12em;display:inline-block"></div>if&nbsp;(msg.msgData.roomJoin[currentRoomName]&nbsp;&amp;&amp;&nbsp;_.isObject(msg.msgData.roomJoin[currentRoomName].roomParameter)){
<a name="line353"></a><div class="linenumber">353</div><div style="width:14em;display:inline-block"></div>currentRoomParameter&nbsp;=&nbsp;msg.msgData.roomJoin[currentRoomName].roomParameter;
<a name="line354"></a><div class="linenumber">354</div><div style="width:12em;display:inline-block"></div>}
<a name="line355"></a><div class="linenumber">355</div>
<a name="line356"></a><div class="linenumber">356</div><div style="width:12em;display:inline-block"></div>if&nbsp;(isRoom)&nbsp;{
<a name="line357"></a><div class="linenumber">357</div><div style="width:14em;display:inline-block"></div>//&nbsp;Join&nbsp;existing&nbsp;room
<a name="line358"></a><div class="linenumber">358</div><div style="width:14em;display:inline-block"></div>pub.events.emit("roomJoin",&nbsp;connectionObj,&nbsp;currentRoomName,&nbsp;currentRoomParameter,&nbsp;roomCallback);
<a name="line359"></a><div class="linenumber">359</div><div style="width:12em;display:inline-block"></div>}
<a name="line360"></a><div class="linenumber">360</div><div style="width:12em;display:inline-block"></div>else&nbsp;if&nbsp;(appObj.getOption("roomAutoCreateEnable"))&nbsp;{
<a name="line361"></a><div class="linenumber">361</div><div style="width:14em;display:inline-block"></div>//&nbsp;Room&nbsp;doesn't&nbsp;yet&nbsp;exist,&nbsp;however&nbsp;we&nbsp;are&nbsp;allowed&nbsp;to&nbsp;create&nbsp;it.
<a name="line362"></a><div class="linenumber">362</div><div style="width:14em;display:inline-block"></div>pub.events.emit("roomCreate",&nbsp;appObj,&nbsp;connectionObj,&nbsp;currentRoomName,&nbsp;null,&nbsp;function(err,&nbsp;roomObj){
<a name="line363"></a><div class="linenumber">363</div><div style="width:16em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line364"></a><div class="linenumber">364</div><div style="width:18em;display:inline-block"></div>roomCallback(err);
<a name="line365"></a><div class="linenumber">365</div><div style="width:18em;display:inline-block"></div>return;
<a name="line366"></a><div class="linenumber">366</div><div style="width:16em;display:inline-block"></div>}
<a name="line367"></a><div class="linenumber">367</div><div style="width:16em;display:inline-block"></div>pub.events.emit("roomJoin",&nbsp;connectionObj,&nbsp;currentRoomName,&nbsp;currentRoomParameter,&nbsp;roomCallback);
<a name="line368"></a><div class="linenumber">368</div><div style="width:14em;display:inline-block"></div>});
<a name="line369"></a><div class="linenumber">369</div><div style="width:12em;display:inline-block"></div>}
<a name="line370"></a><div class="linenumber">370</div><div style="width:12em;display:inline-block"></div>else&nbsp;{
<a name="line371"></a><div class="linenumber">371</div><div style="width:14em;display:inline-block"></div>//&nbsp;Can't&nbsp;join&nbsp;room&nbsp;and&nbsp;we&nbsp;are&nbsp;not&nbsp;allowed&nbsp;to&nbsp;create&nbsp;it.&nbsp;Error&nbsp;Out.
<a name="line372"></a><div class="linenumber">372</div><div style="width:14em;display:inline-block"></div>try{
<a name="line373"></a><div class="linenumber">373</div><div style="width:16em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;pub.util.getErrorMsg("LOGIN_BAD_ROOM"),&nbsp;appObj);
<a name="line374"></a><div class="linenumber">374</div><div style="width:16em;display:inline-block"></div>socket.disconnect();
<a name="line375"></a><div class="linenumber">375</div><div style="width:14em;display:inline-block"></div>}catch(e){}
<a name="line376"></a><div class="linenumber">376</div><div style="width:14em;display:inline-block"></div>pub.util.logInfo("["&nbsp;+&nbsp;easyrtcid&nbsp;+&nbsp;"]&nbsp;Authentication&nbsp;failed.&nbsp;Requested&nbsp;room&nbsp;name&nbsp;does&nbsp;not&nbsp;exist&nbsp;["&nbsp;+&nbsp;currentRoomName&nbsp;+&nbsp;"].");
<a name="line377"></a><div class="linenumber">377</div><div style="width:12em;display:inline-block"></div>}
<a name="line378"></a><div class="linenumber">378</div><div style="width:10em;display:inline-block"></div>});
<a name="line379"></a><div class="linenumber">379</div><div style="width:8em;display:inline-block"></div>},&nbsp;function(err,&nbsp;newRoomObj)&nbsp;{
<a name="line380"></a><div class="linenumber">380</div><div style="width:10em;display:inline-block"></div>asyncCallback(err);
<a name="line381"></a><div class="linenumber">381</div><div style="width:8em;display:inline-block"></div>});
<a name="line382"></a><div class="linenumber">382</div><div style="width:6em;display:inline-block"></div>}
<a name="line383"></a><div class="linenumber">383</div>
<a name="line384"></a><div class="linenumber">384</div><div style="width:6em;display:inline-block"></div>//&nbsp;If&nbsp;no&nbsp;room&nbsp;is&nbsp;initially&nbsp;provided,&nbsp;have&nbsp;them&nbsp;join&nbsp;the&nbsp;default&nbsp;room&nbsp;(if&nbsp;enabled)
<a name="line385"></a><div class="linenumber">385</div><div style="width:6em;display:inline-block"></div>else&nbsp;if&nbsp;(connectionObj.getApp().getOption("roomDefaultEnable"))&nbsp;{
<a name="line386"></a><div class="linenumber">386</div><div style="width:8em;display:inline-block"></div>pub.events.emit("roomJoin",&nbsp;connectionObj,&nbsp;connectionObj.getApp().getOption("roomDefaultName"),&nbsp;null,&nbsp;function(err,&nbsp;roomObj){
<a name="line387"></a><div class="linenumber">387</div><div style="width:10em;display:inline-block"></div>asyncCallback(err);
<a name="line388"></a><div class="linenumber">388</div><div style="width:8em;display:inline-block"></div>});
<a name="line389"></a><div class="linenumber">389</div><div style="width:6em;display:inline-block"></div>}
<a name="line390"></a><div class="linenumber">390</div>
<a name="line391"></a><div class="linenumber">391</div><div style="width:6em;display:inline-block"></div>//&nbsp;No&nbsp;room&nbsp;provided,&nbsp;and&nbsp;can't&nbsp;join&nbsp;default&nbsp;room
<a name="line392"></a><div class="linenumber">392</div><div style="width:6em;display:inline-block"></div>else&nbsp;{
<a name="line393"></a><div class="linenumber">393</div><div style="width:8em;display:inline-block"></div>asyncCallback(null);
<a name="line394"></a><div class="linenumber">394</div><div style="width:6em;display:inline-block"></div>}
<a name="line395"></a><div class="linenumber">395</div><div style="width:4em;display:inline-block"></div>},
<a name="line396"></a><div class="linenumber">396</div>
<a name="line397"></a><div class="linenumber">397</div><div style="width:4em;display:inline-block"></div>function(asyncCallback)&nbsp;{
<a name="line398"></a><div class="linenumber">398</div><div style="width:6em;display:inline-block"></div>//&nbsp;Add&nbsp;new&nbsp;listeners
<a name="line399"></a><div class="linenumber">399</div><div style="width:6em;display:inline-block"></div>socket.on("easyrtcCmd",&nbsp;function(msg,&nbsp;socketCallback){
<a name="line400"></a><div class="linenumber">400</div><div style="width:8em;display:inline-block"></div>if&nbsp;(pub.getOption("logMessagesEnable"))&nbsp;{
<a name="line401"></a><div class="linenumber">401</div><div style="width:10em;display:inline-block"></div>try&nbsp;{
<a name="line402"></a><div class="linenumber">402</div><div style="width:12em;display:inline-block"></div>pub.util.logDebug("["+appName+"]["+easyrtcid+"]&nbsp;Incoming&nbsp;socket.io&nbsp;message:&nbsp;["+JSON.stringify(msg)+"]");
<a name="line403"></a><div class="linenumber">403</div><div style="width:10em;display:inline-block"></div>}
<a name="line404"></a><div class="linenumber">404</div><div style="width:10em;display:inline-block"></div>catch(err)&nbsp;{
<a name="line405"></a><div class="linenumber">405</div><div style="width:12em;display:inline-block"></div>pub.util.logDebug("["+appName+"]["+easyrtcid+"]&nbsp;Incoming&nbsp;socket.io&nbsp;message");
<a name="line406"></a><div class="linenumber">406</div><div style="width:10em;display:inline-block"></div>}
<a name="line407"></a><div class="linenumber">407</div><div style="width:8em;display:inline-block"></div>}
<a name="line408"></a><div class="linenumber">408</div>
<a name="line409"></a><div class="linenumber">409</div><div style="width:8em;display:inline-block"></div>pub.events.emit("easyrtcCmd",&nbsp;connectionObj,&nbsp;msg,&nbsp;socketCallback,&nbsp;function(err){
<a name="line410"></a><div class="linenumber">410</div><div style="width:10em;display:inline-block"></div>if(err){pub.util.logError("["+appName+"]["+easyrtcid+"]&nbsp;Unhandled&nbsp;easyrtcCmd&nbsp;listener&nbsp;error.",&nbsp;err);}
<a name="line411"></a><div class="linenumber">411</div><div style="width:8em;display:inline-block"></div>});
<a name="line412"></a><div class="linenumber">412</div>
<a name="line413"></a><div class="linenumber">413</div><div style="width:6em;display:inline-block"></div>});
<a name="line414"></a><div class="linenumber">414</div><div style="width:6em;display:inline-block"></div>socket.on("easyrtcMsg",&nbsp;function(msg,&nbsp;socketCallback){
<a name="line415"></a><div class="linenumber">415</div><div style="width:8em;display:inline-block"></div>if&nbsp;(pub.getOption("logMessagesEnable"))&nbsp;{
<a name="line416"></a><div class="linenumber">416</div><div style="width:10em;display:inline-block"></div>try&nbsp;{
<a name="line417"></a><div class="linenumber">417</div><div style="width:12em;display:inline-block"></div>pub.util.logDebug("["+appName+"]["+easyrtcid+"]&nbsp;Incoming&nbsp;socket.io&nbsp;message:&nbsp;["+JSON.stringify(msg)+"]");
<a name="line418"></a><div class="linenumber">418</div><div style="width:10em;display:inline-block"></div>}
<a name="line419"></a><div class="linenumber">419</div><div style="width:10em;display:inline-block"></div>catch(err)&nbsp;{
<a name="line420"></a><div class="linenumber">420</div><div style="width:12em;display:inline-block"></div>pub.util.logDebug("["+appName+"]["+easyrtcid+"]&nbsp;Incoming&nbsp;socket.io&nbsp;message");
<a name="line421"></a><div class="linenumber">421</div><div style="width:10em;display:inline-block"></div>}
<a name="line422"></a><div class="linenumber">422</div><div style="width:8em;display:inline-block"></div>}
<a name="line423"></a><div class="linenumber">423</div>
<a name="line424"></a><div class="linenumber">424</div><div style="width:8em;display:inline-block"></div>pub.events.emit("easyrtcMsg",&nbsp;connectionObj,&nbsp;msg,&nbsp;socketCallback,&nbsp;function(err){
<a name="line425"></a><div class="linenumber">425</div><div style="width:10em;display:inline-block"></div>if(err){pub.util.logError("["+appName+"]["+easyrtcid+"]&nbsp;Unhandled&nbsp;easyrtcMsg&nbsp;listener&nbsp;error.",&nbsp;err);}
<a name="line426"></a><div class="linenumber">426</div><div style="width:8em;display:inline-block"></div>});
<a name="line427"></a><div class="linenumber">427</div><div style="width:6em;display:inline-block"></div>});
<a name="line428"></a><div class="linenumber">428</div><div style="width:6em;display:inline-block"></div>socket.on("disconnect",&nbsp;function(){
<a name="line429"></a><div class="linenumber">429</div><div style="width:8em;display:inline-block"></div>pub.events.emit("disconnect",&nbsp;connectionObj,&nbsp;function(err){
<a name="line430"></a><div class="linenumber">430</div><div style="width:10em;display:inline-block"></div>if(err){pub.util.logError("["+appName+"]["+easyrtcid+"]&nbsp;Unhandled&nbsp;disconnect&nbsp;listener&nbsp;error.",&nbsp;err);}
<a name="line431"></a><div class="linenumber">431</div><div style="width:8em;display:inline-block"></div>});
<a name="line432"></a><div class="linenumber">432</div><div style="width:6em;display:inline-block"></div>});
<a name="line433"></a><div class="linenumber">433</div><div style="width:6em;display:inline-block"></div>asyncCallback(null);
<a name="line434"></a><div class="linenumber">434</div><div style="width:4em;display:inline-block"></div>},
<a name="line435"></a><div class="linenumber">435</div>
<a name="line436"></a><div class="linenumber">436</div><div style="width:4em;display:inline-block"></div>function(asyncCallback){
<a name="line437"></a><div class="linenumber">437</div><div style="width:6em;display:inline-block"></div>pub.events.emit("authenticated",&nbsp;connectionObj,&nbsp;asyncCallback);
<a name="line438"></a><div class="linenumber">438</div><div style="width:4em;display:inline-block"></div>},
<a name="line439"></a><div class="linenumber">439</div>
<a name="line440"></a><div class="linenumber">440</div><div style="width:4em;display:inline-block"></div>function(asyncCallback){
<a name="line441"></a><div class="linenumber">441</div><div style="width:6em;display:inline-block"></div>pub.events.emit("emitReturnToken",&nbsp;connectionObj,&nbsp;socketCallback,&nbsp;asyncCallback);
<a name="line442"></a><div class="linenumber">442</div><div style="width:4em;display:inline-block"></div>},
<a name="line443"></a><div class="linenumber">443</div>
<a name="line444"></a><div class="linenumber">444</div><div style="width:4em;display:inline-block"></div>function(asyncCallback){
<a name="line445"></a><div class="linenumber">445</div>
<a name="line446"></a><div class="linenumber">446</div><div style="width:6em;display:inline-block"></div>//&nbsp;TODO:&nbsp;Reinstate&nbsp;this&nbsp;emit&nbsp;function&nbsp;by&nbsp;setting&nbsp;flag&nbsp;for&nbsp;roomJoin&nbsp;event&nbsp;so&nbsp;it&nbsp;doesn't&nbsp;automatically&nbsp;emit&nbsp;delta's
<a name="line447"></a><div class="linenumber">447</div><div style="width:6em;display:inline-block"></div>//&nbsp;Emit&nbsp;clientList&nbsp;delta&nbsp;to&nbsp;other&nbsp;clients&nbsp;in&nbsp;room
<a name="line448"></a><div class="linenumber">448</div><div style="width:6em;display:inline-block"></div>//&nbsp;connectionObj.emitRoomDataDelta(false,&nbsp;function(err,&nbsp;roomDataObj){asyncCallback(err);});
<a name="line449"></a><div class="linenumber">449</div><div style="width:6em;display:inline-block"></div>asyncCallback(null);
<a name="line450"></a><div class="linenumber">450</div><div style="width:4em;display:inline-block"></div>}
<a name="line451"></a><div class="linenumber">451</div>
<a name="line452"></a><div class="linenumber">452</div><div style="width:2em;display:inline-block"></div>],
<a name="line453"></a><div class="linenumber">453</div><div style="width:2em;display:inline-block"></div>//&nbsp;This&nbsp;function&nbsp;is&nbsp;called&nbsp;upon&nbsp;completion&nbsp;of&nbsp;the&nbsp;async&nbsp;waterfall,&nbsp;or&nbsp;upon&nbsp;an&nbsp;error&nbsp;being&nbsp;thrown.
<a name="line454"></a><div class="linenumber">454</div><div style="width:2em;display:inline-block"></div>function&nbsp;(err)&nbsp;{
<a name="line455"></a><div class="linenumber">455</div><div style="width:4em;display:inline-block"></div>if&nbsp;(err){
<a name="line456"></a><div class="linenumber">456</div><div style="width:6em;display:inline-block"></div>try{
<a name="line457"></a><div class="linenumber">457</div><div style="width:8em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;pub.util.getErrorMsg("LOGIN_GEN_FAIL"),&nbsp;appObj);
<a name="line458"></a><div class="linenumber">458</div><div style="width:8em;display:inline-block"></div>socket.disconnect();
<a name="line459"></a><div class="linenumber">459</div><div style="width:8em;display:inline-block"></div>pub.util.logError("["+easyrtcid+"]&nbsp;General&nbsp;authentication&nbsp;error.&nbsp;Socket&nbsp;disconnected.",&nbsp;err);
<a name="line460"></a><div class="linenumber">460</div><div style="width:6em;display:inline-block"></div>}catch(e){}
<a name="line461"></a><div class="linenumber">461</div><div style="width:4em;display:inline-block"></div>}&nbsp;else&nbsp;{
<a name="line462"></a><div class="linenumber">462</div><div style="width:6em;display:inline-block"></div>callback(null,&nbsp;connectionObj);
<a name="line463"></a><div class="linenumber">463</div><div style="width:4em;display:inline-block"></div>}
<a name="line464"></a><div class="linenumber">464</div><div style="width:2em;display:inline-block"></div>});
<a name="line465"></a><div class="linenumber">465</div><div style="width:0em;display:inline-block"></div>};
<a name="line466"></a><div class="linenumber">466</div>
<a name="line467"></a><div class="linenumber">467</div>
<a name="line468"></a><div class="linenumber">468</div><div style="width:0em;display:inline-block"></div>/**
<a name="line469"></a><div class="linenumber">469</div><div style="width:0em;display:inline-block"></div>*&nbsp;Default&nbsp;listener&nbsp;for&nbsp;event&nbsp;"easyrtcCmd".&nbsp;This&nbsp;event&nbsp;is&nbsp;fired&nbsp;when&nbsp;an&nbsp;incoming&nbsp;'easyrtcCmd'&nbsp;message&nbsp;is&nbsp;received&nbsp;from&nbsp;a&nbsp;client.
<a name="line470"></a><div class="linenumber">470</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line471"></a><div class="linenumber">471</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;connectionObj&nbsp;&nbsp;EasyRTC&nbsp;connection&nbsp;object.&nbsp;Contains&nbsp;methods&nbsp;used&nbsp;for&nbsp;identifying&nbsp;and&nbsp;managing&nbsp;a&nbsp;connection.
<a name="line472"></a><div class="linenumber">472</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;msg&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Message&nbsp;object&nbsp;which&nbsp;contains&nbsp;the&nbsp;full&nbsp;message&nbsp;from&nbsp;a&nbsp;client;&nbsp;this&nbsp;can&nbsp;include&nbsp;the&nbsp;standard&nbsp;msgType&nbsp;and&nbsp;msgData&nbsp;fields.
<a name="line473"></a><div class="linenumber">473</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Function}&nbsp;socketCallback&nbsp;Socket.io&nbsp;callback&nbsp;function&nbsp;which&nbsp;delivers&nbsp;a&nbsp;response&nbsp;to&nbsp;a&nbsp;socket.&nbsp;Expects&nbsp;a&nbsp;single&nbsp;parameter&nbsp;(msg).
<a name="line474"></a><div class="linenumber">474</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line475"></a><div class="linenumber">475</div><div style="width:0em;display:inline-block"></div>*/
<a name="line476"></a><div class="linenumber">476</div><div style="width:0em;display:inline-block"></div>eventListener.onEasyrtcCmd&nbsp;=&nbsp;function(connectionObj,&nbsp;msg,&nbsp;socketCallback,&nbsp;next){
<a name="line477"></a><div class="linenumber">477</div><div style="width:2em;display:inline-block"></div>var&nbsp;appName&nbsp;=&nbsp;connectionObj.getAppName();
<a name="line478"></a><div class="linenumber">478</div><div style="width:2em;display:inline-block"></div>var&nbsp;appObj&nbsp;=&nbsp;connectionObj.getApp();
<a name="line479"></a><div class="linenumber">479</div><div style="width:2em;display:inline-block"></div>var&nbsp;easyrtcid&nbsp;=&nbsp;connectionObj.getEasyrtcid();
<a name="line480"></a><div class="linenumber">480</div>
<a name="line481"></a><div class="linenumber">481</div>
<a name="line482"></a><div class="linenumber">482</div><div style="width:2em;display:inline-block"></div>pub.util.logDebug("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;EasyRTC&nbsp;command&nbsp;received&nbsp;with&nbsp;msgType&nbsp;["&nbsp;+&nbsp;msg.msgType&nbsp;+&nbsp;"]");
<a name="line483"></a><div class="linenumber">483</div><div style="width:2em;display:inline-block"></div>if&nbsp;(!_.isFunction(next))&nbsp;{
<a name="line484"></a><div class="linenumber">484</div><div style="width:4em;display:inline-block"></div>next&nbsp;=&nbsp;pub.util.nextToNowhere;
<a name="line485"></a><div class="linenumber">485</div><div style="width:2em;display:inline-block"></div>}
<a name="line486"></a><div class="linenumber">486</div>
<a name="line487"></a><div class="linenumber">487</div><div style="width:2em;display:inline-block"></div>if(!_.isFunction(socketCallback))&nbsp;{
<a name="line488"></a><div class="linenumber">488</div><div style="width:4em;display:inline-block"></div>pub.util.logWarning("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;EasyRTC&nbsp;command&nbsp;message&nbsp;received&nbsp;with&nbsp;no&nbsp;callback.&nbsp;Ignoring.",&nbsp;msg);
<a name="line489"></a><div class="linenumber">489</div><div style="width:4em;display:inline-block"></div>return;
<a name="line490"></a><div class="linenumber">490</div><div style="width:2em;display:inline-block"></div>}
<a name="line491"></a><div class="linenumber">491</div>
<a name="line492"></a><div class="linenumber">492</div><div style="width:2em;display:inline-block"></div>async.waterfall([
<a name="line493"></a><div class="linenumber">493</div><div style="width:4em;display:inline-block"></div>function(asyncCallback)&nbsp;{
<a name="line494"></a><div class="linenumber">494</div><div style="width:6em;display:inline-block"></div>//&nbsp;Check&nbsp;message&nbsp;structure
<a name="line495"></a><div class="linenumber">495</div><div style="width:6em;display:inline-block"></div>pub.util.isValidIncomingMessage("easyrtcCmd",&nbsp;msg,&nbsp;connectionObj.getApp(),&nbsp;asyncCallback);
<a name="line496"></a><div class="linenumber">496</div><div style="width:4em;display:inline-block"></div>},
<a name="line497"></a><div class="linenumber">497</div>
<a name="line498"></a><div class="linenumber">498</div><div style="width:4em;display:inline-block"></div>function(isMsgValid,&nbsp;msgErrorCode,&nbsp;asyncCallback)&nbsp;{
<a name="line499"></a><div class="linenumber">499</div><div style="width:6em;display:inline-block"></div>//&nbsp;If&nbsp;message&nbsp;structure&nbsp;is&nbsp;invalid,&nbsp;send&nbsp;error,&nbsp;and&nbsp;write&nbsp;to&nbsp;log
<a name="line500"></a><div class="linenumber">500</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!isMsgValid)&nbsp;{
<a name="line501"></a><div class="linenumber">501</div><div style="width:8em;display:inline-block"></div>try{
<a name="line502"></a><div class="linenumber">502</div><div style="width:10em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;pub.util.getErrorMsg(msgErrorCode),&nbsp;appObj);
<a name="line503"></a><div class="linenumber">503</div><div style="width:8em;display:inline-block"></div>}catch(e){}
<a name="line504"></a><div class="linenumber">504</div><div style="width:8em;display:inline-block"></div>pub.util.logWarning("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;EasyRTC&nbsp;Auth&nbsp;message&nbsp;received&nbsp;with&nbsp;invalid&nbsp;message&nbsp;format&nbsp;["&nbsp;+&nbsp;msgErrorCode&nbsp;+&nbsp;"].&nbsp;Disconnecting&nbsp;socket.",&nbsp;msg);
<a name="line505"></a><div class="linenumber">505</div><div style="width:8em;display:inline-block"></div>return;
<a name="line506"></a><div class="linenumber">506</div><div style="width:6em;display:inline-block"></div>}
<a name="line507"></a><div class="linenumber">507</div><div style="width:6em;display:inline-block"></div>asyncCallback(null);
<a name="line508"></a><div class="linenumber">508</div><div style="width:4em;display:inline-block"></div>},
<a name="line509"></a><div class="linenumber">509</div><div style="width:4em;display:inline-block"></div>function(asyncCallback)&nbsp;{
<a name="line510"></a><div class="linenumber">510</div><div style="width:6em;display:inline-block"></div>//&nbsp;The&nbsp;msgType&nbsp;controls&nbsp;how&nbsp;each&nbsp;message&nbsp;is&nbsp;handled
<a name="line511"></a><div class="linenumber">511</div><div style="width:6em;display:inline-block"></div>switch(msg.msgType)&nbsp;{
<a name="line512"></a><div class="linenumber">512</div><div style="width:8em;display:inline-block"></div>case&nbsp;"setUserCfg":
<a name="line513"></a><div class="linenumber">513</div><div style="width:10em;display:inline-block"></div>pub.util.logDebug("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;WebRTC&nbsp;setUserCfg&nbsp;command&nbsp;received.&nbsp;This&nbsp;feature&nbsp;is&nbsp;not&nbsp;yet&nbsp;complete.");
<a name="line514"></a><div class="linenumber">514</div><div style="width:10em;display:inline-block"></div>pub.util.sendSocketCallbackAck(easyrtcid,&nbsp;socketCallback,&nbsp;appObj);
<a name="line515"></a><div class="linenumber">515</div><div style="width:10em;display:inline-block"></div>next(null);
<a name="line516"></a><div class="linenumber">516</div><div style="width:10em;display:inline-block"></div>break;
<a name="line517"></a><div class="linenumber">517</div>
<a name="line518"></a><div class="linenumber">518</div><div style="width:8em;display:inline-block"></div>case&nbsp;"setPresence":
<a name="line519"></a><div class="linenumber">519</div><div style="width:10em;display:inline-block"></div>pub.events.emit("msgTypeSetPresence",&nbsp;connectionObj,&nbsp;msg.msgData.setPresence,&nbsp;socketCallback,&nbsp;next);
<a name="line520"></a><div class="linenumber">520</div><div style="width:10em;display:inline-block"></div>break;
<a name="line521"></a><div class="linenumber">521</div>
<a name="line522"></a><div class="linenumber">522</div><div style="width:8em;display:inline-block"></div>case&nbsp;"setRoomApiField":
<a name="line523"></a><div class="linenumber">523</div><div style="width:10em;display:inline-block"></div>pub.events.emit("msgTypeSetRoomApiField",&nbsp;connectionObj,&nbsp;msg.msgData.setRoomApiField,&nbsp;socketCallback,&nbsp;next);
<a name="line524"></a><div class="linenumber">524</div><div style="width:10em;display:inline-block"></div>break;
<a name="line525"></a><div class="linenumber">525</div>
<a name="line526"></a><div class="linenumber">526</div><div style="width:8em;display:inline-block"></div>case&nbsp;"roomJoin":
<a name="line527"></a><div class="linenumber">527</div><div style="width:10em;display:inline-block"></div>pub.events.emit("msgTypeRoomJoin",&nbsp;connectionObj,&nbsp;msg.msgData.roomJoin,&nbsp;socketCallback,&nbsp;next);
<a name="line528"></a><div class="linenumber">528</div><div style="width:10em;display:inline-block"></div>break;
<a name="line529"></a><div class="linenumber">529</div>
<a name="line530"></a><div class="linenumber">530</div><div style="width:8em;display:inline-block"></div>case&nbsp;"roomLeave":
<a name="line531"></a><div class="linenumber">531</div><div style="width:10em;display:inline-block"></div>pub.events.emit("msgTypeRoomLeave",&nbsp;connectionObj,&nbsp;msg.msgData.roomLeave,&nbsp;socketCallback,&nbsp;next);
<a name="line532"></a><div class="linenumber">532</div><div style="width:10em;display:inline-block"></div>break;
<a name="line533"></a><div class="linenumber">533</div>
<a name="line534"></a><div class="linenumber">534</div><div style="width:8em;display:inline-block"></div>case&nbsp;"getIceConfig":
<a name="line535"></a><div class="linenumber">535</div><div style="width:10em;display:inline-block"></div>pub.events.emit("msgTypeGetIceConfig",&nbsp;connectionObj,&nbsp;socketCallback,&nbsp;next);
<a name="line536"></a><div class="linenumber">536</div><div style="width:10em;display:inline-block"></div>break;
<a name="line537"></a><div class="linenumber">537</div>
<a name="line538"></a><div class="linenumber">538</div><div style="width:8em;display:inline-block"></div>case&nbsp;"getRoomList":
<a name="line539"></a><div class="linenumber">539</div><div style="width:10em;display:inline-block"></div>pub.events.emit("msgTypeGetRoomList",&nbsp;connectionObj,&nbsp;socketCallback,&nbsp;next);
<a name="line540"></a><div class="linenumber">540</div><div style="width:10em;display:inline-block"></div>break;
<a name="line541"></a><div class="linenumber">541</div>
<a name="line542"></a><div class="linenumber">542</div><div style="width:8em;display:inline-block"></div>case&nbsp;"candidate":
<a name="line543"></a><div class="linenumber">543</div><div style="width:8em;display:inline-block"></div>case&nbsp;"offer":
<a name="line544"></a><div class="linenumber">544</div><div style="width:8em;display:inline-block"></div>case&nbsp;"answer":
<a name="line545"></a><div class="linenumber">545</div><div style="width:8em;display:inline-block"></div>case&nbsp;"reject":
<a name="line546"></a><div class="linenumber">546</div><div style="width:8em;display:inline-block"></div>case&nbsp;"hangup":
<a name="line547"></a><div class="linenumber">547</div><div style="width:10em;display:inline-block"></div>//&nbsp;Relay&nbsp;message&nbsp;to&nbsp;targetEasyrtcid
<a name="line548"></a><div class="linenumber">548</div><div style="width:10em;display:inline-block"></div>var&nbsp;outgoingMsg&nbsp;=&nbsp;{senderEasyrtcid:&nbsp;connectionObj.getEasyrtcid(),&nbsp;msgData:msg.msgData};
<a name="line549"></a><div class="linenumber">549</div>
<a name="line550"></a><div class="linenumber">550</div><div style="width:10em;display:inline-block"></div>connectionObj.getApp().connection(msg.targetEasyrtcid,&nbsp;function(err,targetConnectionObj){
<a name="line551"></a><div class="linenumber">551</div><div style="width:12em;display:inline-block"></div>if&nbsp;(err){
<a name="line552"></a><div class="linenumber">552</div><div style="width:14em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;pub.util.getErrorMsg("MSG_REJECT_TARGET_EASYRTCID"),&nbsp;appObj);
<a name="line553"></a><div class="linenumber">553</div><div style="width:14em;display:inline-block"></div>pub.util.logWarning("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;Could&nbsp;not&nbsp;send&nbsp;WebRTC&nbsp;signal&nbsp;to&nbsp;client&nbsp;["&nbsp;+&nbsp;msg.targetEasyrtcid&nbsp;+&nbsp;"].&nbsp;They&nbsp;may&nbsp;no&nbsp;longer&nbsp;be&nbsp;online.");
<a name="line554"></a><div class="linenumber">554</div><div style="width:14em;display:inline-block"></div>return;
<a name="line555"></a><div class="linenumber">555</div><div style="width:12em;display:inline-block"></div>}
<a name="line556"></a><div class="linenumber">556</div><div style="width:12em;display:inline-block"></div>pub.events.emit("emitEasyrtcCmd",&nbsp;targetConnectionObj,&nbsp;msg.msgType,&nbsp;outgoingMsg,&nbsp;null,&nbsp;next);
<a name="line557"></a><div class="linenumber">557</div><div style="width:12em;display:inline-block"></div>pub.util.sendSocketCallbackAck(easyrtcid,&nbsp;socketCallback,&nbsp;appObj);
<a name="line558"></a><div class="linenumber">558</div><div style="width:12em;display:inline-block"></div>next(null);
<a name="line559"></a><div class="linenumber">559</div><div style="width:10em;display:inline-block"></div>});
<a name="line560"></a><div class="linenumber">560</div><div style="width:10em;display:inline-block"></div>break;
<a name="line561"></a><div class="linenumber">561</div>
<a name="line562"></a><div class="linenumber">562</div><div style="width:8em;display:inline-block"></div>default:
<a name="line563"></a><div class="linenumber">563</div><div style="width:10em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;pub.util.getErrorMsg("MSG_REJECT_BAD_TYPE"),&nbsp;appObj);
<a name="line564"></a><div class="linenumber">564</div><div style="width:10em;display:inline-block"></div>pub.util.logWarning("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;Received&nbsp;easyrtcCmd&nbsp;message&nbsp;with&nbsp;unhandled&nbsp;msgType.",&nbsp;msg);
<a name="line565"></a><div class="linenumber">565</div><div style="width:10em;display:inline-block"></div>next(null);
<a name="line566"></a><div class="linenumber">566</div><div style="width:6em;display:inline-block"></div>}
<a name="line567"></a><div class="linenumber">567</div><div style="width:4em;display:inline-block"></div>}
<a name="line568"></a><div class="linenumber">568</div><div style="width:2em;display:inline-block"></div>],
<a name="line569"></a><div class="linenumber">569</div><div style="width:2em;display:inline-block"></div>function(err)&nbsp;{
<a name="line570"></a><div class="linenumber">570</div><div style="width:4em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line571"></a><div class="linenumber">571</div><div style="width:6em;display:inline-block"></div>try&nbsp;{
<a name="line572"></a><div class="linenumber">572</div><div style="width:8em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;pub.util.getErrorMsg("MSG_REJECT_GEN_FAIL"),&nbsp;appObj);
<a name="line573"></a><div class="linenumber">573</div><div style="width:8em;display:inline-block"></div>pub.util.logWarning("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;Received&nbsp;easyrtcCmd&nbsp;message&nbsp;with&nbsp;general&nbsp;error.",&nbsp;msg);
<a name="line574"></a><div class="linenumber">574</div><div style="width:6em;display:inline-block"></div>}&nbsp;catch(e){}
<a name="line575"></a><div class="linenumber">575</div><div style="width:4em;display:inline-block"></div>}
<a name="line576"></a><div class="linenumber">576</div><div style="width:2em;display:inline-block"></div>});
<a name="line577"></a><div class="linenumber">577</div><div style="width:0em;display:inline-block"></div>};
<a name="line578"></a><div class="linenumber">578</div>
<a name="line579"></a><div class="linenumber">579</div>
<a name="line580"></a><div class="linenumber">580</div><div style="width:0em;display:inline-block"></div>/**
<a name="line581"></a><div class="linenumber">581</div><div style="width:0em;display:inline-block"></div>*&nbsp;Default&nbsp;listener&nbsp;for&nbsp;event&nbsp;"easyrtcMsg".&nbsp;This&nbsp;event&nbsp;is&nbsp;fired&nbsp;when&nbsp;an&nbsp;incoming&nbsp;'easyrtcMsg'&nbsp;message&nbsp;is&nbsp;received&nbsp;from&nbsp;a&nbsp;client.
<a name="line582"></a><div class="linenumber">582</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line583"></a><div class="linenumber">583</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;connectionObj&nbsp;&nbsp;EasyRTC&nbsp;connection&nbsp;object.&nbsp;Contains&nbsp;methods&nbsp;used&nbsp;for&nbsp;identifying&nbsp;and&nbsp;managing&nbsp;a&nbsp;connection.
<a name="line584"></a><div class="linenumber">584</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;msg&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Message&nbsp;object&nbsp;which&nbsp;contains&nbsp;the&nbsp;full&nbsp;message&nbsp;from&nbsp;a&nbsp;client;&nbsp;this&nbsp;can&nbsp;include&nbsp;the&nbsp;standard&nbsp;msgType&nbsp;and&nbsp;msgData&nbsp;fields.
<a name="line585"></a><div class="linenumber">585</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Function}&nbsp;socketCallback&nbsp;Socket.io&nbsp;callback&nbsp;function&nbsp;which&nbsp;delivers&nbsp;a&nbsp;response&nbsp;to&nbsp;a&nbsp;socket.&nbsp;Expects&nbsp;a&nbsp;single&nbsp;parameter&nbsp;(msg).
<a name="line586"></a><div class="linenumber">586</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line587"></a><div class="linenumber">587</div><div style="width:0em;display:inline-block"></div>*/
<a name="line588"></a><div class="linenumber">588</div><div style="width:0em;display:inline-block"></div>eventListener.onEasyrtcMsg&nbsp;=&nbsp;function(connectionObj,&nbsp;msg,&nbsp;socketCallback,&nbsp;next){
<a name="line589"></a><div class="linenumber">589</div><div style="width:2em;display:inline-block"></div>var&nbsp;easyrtcid&nbsp;=&nbsp;connectionObj.getEasyrtcid();
<a name="line590"></a><div class="linenumber">590</div><div style="width:2em;display:inline-block"></div>var&nbsp;appObj&nbsp;=&nbsp;connectionObj.getApp();
<a name="line591"></a><div class="linenumber">591</div>
<a name="line592"></a><div class="linenumber">592</div>
<a name="line593"></a><div class="linenumber">593</div><div style="width:2em;display:inline-block"></div>pub.util.logDebug("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;EasyRTC&nbsp;message&nbsp;received&nbsp;of&nbsp;type&nbsp;["&nbsp;+&nbsp;msg.msgType&nbsp;+&nbsp;"]");
<a name="line594"></a><div class="linenumber">594</div>
<a name="line595"></a><div class="linenumber">595</div><div style="width:2em;display:inline-block"></div>if&nbsp;(!_.isFunction(next))&nbsp;{
<a name="line596"></a><div class="linenumber">596</div><div style="width:4em;display:inline-block"></div>next&nbsp;=&nbsp;pub.util.nextToNowhere;
<a name="line597"></a><div class="linenumber">597</div><div style="width:2em;display:inline-block"></div>}
<a name="line598"></a><div class="linenumber">598</div>
<a name="line599"></a><div class="linenumber">599</div><div style="width:2em;display:inline-block"></div>if(!_.isFunction(socketCallback))&nbsp;{
<a name="line600"></a><div class="linenumber">600</div><div style="width:4em;display:inline-block"></div>pub.util.logWarning("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;EasyRTC&nbsp;message&nbsp;received&nbsp;with&nbsp;no&nbsp;callback.&nbsp;Ignoring&nbsp;message.",&nbsp;msg);
<a name="line601"></a><div class="linenumber">601</div><div style="width:4em;display:inline-block"></div>return;
<a name="line602"></a><div class="linenumber">602</div><div style="width:2em;display:inline-block"></div>}
<a name="line603"></a><div class="linenumber">603</div>
<a name="line604"></a><div class="linenumber">604</div><div style="width:2em;display:inline-block"></div>async.waterfall([
<a name="line605"></a><div class="linenumber">605</div><div style="width:4em;display:inline-block"></div>function(asyncCallback)&nbsp;{
<a name="line606"></a><div class="linenumber">606</div><div style="width:6em;display:inline-block"></div>//&nbsp;Check&nbsp;message&nbsp;structure
<a name="line607"></a><div class="linenumber">607</div><div style="width:6em;display:inline-block"></div>pub.util.isValidIncomingMessage("easyrtcMsg",&nbsp;msg,&nbsp;connectionObj.getApp(),&nbsp;asyncCallback);
<a name="line608"></a><div class="linenumber">608</div><div style="width:4em;display:inline-block"></div>},
<a name="line609"></a><div class="linenumber">609</div>
<a name="line610"></a><div class="linenumber">610</div><div style="width:4em;display:inline-block"></div>function(isMsgValid,&nbsp;msgErrorCode,&nbsp;asyncCallback)&nbsp;{
<a name="line611"></a><div class="linenumber">611</div><div style="width:6em;display:inline-block"></div>//&nbsp;If&nbsp;message&nbsp;structure&nbsp;is&nbsp;invalid,&nbsp;send&nbsp;error,&nbsp;and&nbsp;write&nbsp;to&nbsp;log
<a name="line612"></a><div class="linenumber">612</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!isMsgValid)&nbsp;{
<a name="line613"></a><div class="linenumber">613</div><div style="width:8em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;pub.util.getErrorMsg(msgErrorCode),&nbsp;appObj);
<a name="line614"></a><div class="linenumber">614</div><div style="width:8em;display:inline-block"></div>pub.util.logWarning("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;EasyRTC&nbsp;message&nbsp;received&nbsp;with&nbsp;invalid&nbsp;message&nbsp;format&nbsp;["&nbsp;+&nbsp;msgErrorCode&nbsp;+&nbsp;"].",&nbsp;msg);
<a name="line615"></a><div class="linenumber">615</div><div style="width:8em;display:inline-block"></div>return;
<a name="line616"></a><div class="linenumber">616</div><div style="width:6em;display:inline-block"></div>}
<a name="line617"></a><div class="linenumber">617</div><div style="width:6em;display:inline-block"></div>asyncCallback(null);
<a name="line618"></a><div class="linenumber">618</div><div style="width:4em;display:inline-block"></div>},
<a name="line619"></a><div class="linenumber">619</div><div style="width:4em;display:inline-block"></div>function(asyncCallback)&nbsp;{
<a name="line620"></a><div class="linenumber">620</div>
<a name="line621"></a><div class="linenumber">621</div><div style="width:6em;display:inline-block"></div>//&nbsp;test&nbsp;targetEasyrtcid&nbsp;(if&nbsp;defined).&nbsp;Will&nbsp;prevent&nbsp;client&nbsp;from&nbsp;sending&nbsp;to&nbsp;themselves
<a name="line622"></a><div class="linenumber">622</div><div style="width:6em;display:inline-block"></div>if&nbsp;(msg.targetEasyrtcid&nbsp;&nbsp;!==&nbsp;undefined&nbsp;&amp;&amp;&nbsp;msg.targetEasyrtcid&nbsp;==&nbsp;connectionObj.getEasyrtcid())&nbsp;{
<a name="line623"></a><div class="linenumber">623</div><div style="width:8em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;pub.util.getErrorMsg("MSG_REJECT_TARGET_EASYRTCID"),&nbsp;appObj);
<a name="line624"></a><div class="linenumber">624</div><div style="width:8em;display:inline-block"></div>pub.util.logWarning("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;EasyRTC&nbsp;message&nbsp;received&nbsp;with&nbsp;improper&nbsp;targetEasyrtcid",&nbsp;msg);
<a name="line625"></a><div class="linenumber">625</div><div style="width:8em;display:inline-block"></div>return;
<a name="line626"></a><div class="linenumber">626</div><div style="width:6em;display:inline-block"></div>}
<a name="line627"></a><div class="linenumber">627</div>
<a name="line628"></a><div class="linenumber">628</div><div style="width:6em;display:inline-block"></div>//&nbsp;Determine&nbsp;if&nbsp;sending&nbsp;message&nbsp;to&nbsp;single&nbsp;client,&nbsp;an&nbsp;entire&nbsp;room,&nbsp;or&nbsp;an&nbsp;entire&nbsp;group
<a name="line629"></a><div class="linenumber">629</div><div style="width:6em;display:inline-block"></div>if&nbsp;(msg.targetEasyrtcid&nbsp;!==&nbsp;undefined)&nbsp;{
<a name="line630"></a><div class="linenumber">630</div><div style="width:8em;display:inline-block"></div>//&nbsp;Relay&nbsp;a&nbsp;message&nbsp;to&nbsp;a&nbsp;single&nbsp;client
<a name="line631"></a><div class="linenumber">631</div><div style="width:8em;display:inline-block"></div>var&nbsp;outgoingMsg&nbsp;=&nbsp;{
<a name="line632"></a><div class="linenumber">632</div><div style="width:10em;display:inline-block"></div>senderEasyrtcid:&nbsp;connectionObj.getEasyrtcid(),
<a name="line633"></a><div class="linenumber">633</div><div style="width:10em;display:inline-block"></div>targetEasyrtcid:&nbsp;msg.targetEasyrtcid,
<a name="line634"></a><div class="linenumber">634</div><div style="width:10em;display:inline-block"></div>msgType:&nbsp;msg.msgType,
<a name="line635"></a><div class="linenumber">635</div><div style="width:10em;display:inline-block"></div>msgData:&nbsp;msg.msgData
<a name="line636"></a><div class="linenumber">636</div><div style="width:8em;display:inline-block"></div>};
<a name="line637"></a><div class="linenumber">637</div><div style="width:8em;display:inline-block"></div>var&nbsp;targetConnectionObj&nbsp;=&nbsp;{};
<a name="line638"></a><div class="linenumber">638</div>
<a name="line639"></a><div class="linenumber">639</div><div style="width:8em;display:inline-block"></div>async.waterfall([
<a name="line640"></a><div class="linenumber">640</div><div style="width:10em;display:inline-block"></div>function(asyncCallback)&nbsp;{
<a name="line641"></a><div class="linenumber">641</div><div style="width:12em;display:inline-block"></div>//&nbsp;getting&nbsp;connection&nbsp;object&nbsp;for&nbsp;targetEasyrtcid
<a name="line642"></a><div class="linenumber">642</div><div style="width:12em;display:inline-block"></div>connectionObj.getApp().connection(msg.targetEasyrtcid,&nbsp;asyncCallback);
<a name="line643"></a><div class="linenumber">643</div><div style="width:10em;display:inline-block"></div>},
<a name="line644"></a><div class="linenumber">644</div><div style="width:10em;display:inline-block"></div>function(newTargetConnectionObj,&nbsp;asyncCallback)&nbsp;{
<a name="line645"></a><div class="linenumber">645</div><div style="width:12em;display:inline-block"></div>targetConnectionObj&nbsp;=&nbsp;newTargetConnectionObj;
<a name="line646"></a><div class="linenumber">646</div>
<a name="line647"></a><div class="linenumber">647</div><div style="width:12em;display:inline-block"></div>//&nbsp;TODO:&nbsp;Add&nbsp;option&nbsp;to&nbsp;restrict&nbsp;users&nbsp;not&nbsp;in&nbsp;same&nbsp;room&nbsp;from&nbsp;sending&nbsp;messages&nbsp;to&nbsp;users&nbsp;in&nbsp;room
<a name="line648"></a><div class="linenumber">648</div>
<a name="line649"></a><div class="linenumber">649</div><div style="width:12em;display:inline-block"></div>//&nbsp;Handle&nbsp;targetRoom&nbsp;(if&nbsp;present)
<a name="line650"></a><div class="linenumber">650</div><div style="width:12em;display:inline-block"></div>if&nbsp;(msg.targetRoom)&nbsp;{
<a name="line651"></a><div class="linenumber">651</div><div style="width:14em;display:inline-block"></div>targetConnectionObj.isInRoom(msg.targetRoom,&nbsp;function(err,&nbsp;isAllowed){
<a name="line652"></a><div class="linenumber">652</div><div style="width:16em;display:inline-block"></div>if&nbsp;(err&nbsp;||&nbsp;!isAllowed)&nbsp;{
<a name="line653"></a><div class="linenumber">653</div><div style="width:18em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;pub.util.getErrorMsg("MSG_REJECT_TARGET_ROOM"),&nbsp;appObj);
<a name="line654"></a><div class="linenumber">654</div><div style="width:18em;display:inline-block"></div>pub.util.logWarning("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;EasyRTC&nbsp;message&nbsp;received&nbsp;with&nbsp;improper&nbsp;target&nbsp;room",&nbsp;msg);
<a name="line655"></a><div class="linenumber">655</div><div style="width:18em;display:inline-block"></div>return;
<a name="line656"></a><div class="linenumber">656</div><div style="width:16em;display:inline-block"></div>}
<a name="line657"></a><div class="linenumber">657</div><div style="width:16em;display:inline-block"></div>outgoingMsg.targetRoom&nbsp;=&nbsp;msg.targetRoom;
<a name="line658"></a><div class="linenumber">658</div><div style="width:16em;display:inline-block"></div>asyncCallback(null);
<a name="line659"></a><div class="linenumber">659</div><div style="width:14em;display:inline-block"></div>});
<a name="line660"></a><div class="linenumber">660</div><div style="width:12em;display:inline-block"></div>}
<a name="line661"></a><div class="linenumber">661</div><div style="width:12em;display:inline-block"></div>else&nbsp;{
<a name="line662"></a><div class="linenumber">662</div><div style="width:14em;display:inline-block"></div>asyncCallback(null);
<a name="line663"></a><div class="linenumber">663</div><div style="width:12em;display:inline-block"></div>}
<a name="line664"></a><div class="linenumber">664</div><div style="width:10em;display:inline-block"></div>},
<a name="line665"></a><div class="linenumber">665</div>
<a name="line666"></a><div class="linenumber">666</div><div style="width:10em;display:inline-block"></div>function(asyncCallback)&nbsp;{
<a name="line667"></a><div class="linenumber">667</div><div style="width:12em;display:inline-block"></div>//&nbsp;Handle&nbsp;targetGroup&nbsp;(if&nbsp;present)
<a name="line668"></a><div class="linenumber">668</div><div style="width:12em;display:inline-block"></div>if&nbsp;(msg.targetGroup)&nbsp;{
<a name="line669"></a><div class="linenumber">669</div><div style="width:14em;display:inline-block"></div>targetConnectionObj.isInGroup(msg.targetGroup,&nbsp;function(err,&nbsp;isAllowed){
<a name="line670"></a><div class="linenumber">670</div><div style="width:16em;display:inline-block"></div>if&nbsp;(err&nbsp;||&nbsp;!isAllowed)&nbsp;{
<a name="line671"></a><div class="linenumber">671</div><div style="width:18em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;pub.util.getErrorMsg("MSG_REJECT_TARGET_GROUP"),&nbsp;appObj);
<a name="line672"></a><div class="linenumber">672</div><div style="width:18em;display:inline-block"></div>pub.util.logWarning("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;EasyRTC&nbsp;message&nbsp;received&nbsp;with&nbsp;improper&nbsp;target&nbsp;group",&nbsp;msg);
<a name="line673"></a><div class="linenumber">673</div><div style="width:18em;display:inline-block"></div>return;
<a name="line674"></a><div class="linenumber">674</div><div style="width:16em;display:inline-block"></div>}
<a name="line675"></a><div class="linenumber">675</div><div style="width:16em;display:inline-block"></div>outgoingMsg.targetGroup&nbsp;=&nbsp;msg.targetGroup;
<a name="line676"></a><div class="linenumber">676</div><div style="width:16em;display:inline-block"></div>asyncCallback(null);
<a name="line677"></a><div class="linenumber">677</div><div style="width:14em;display:inline-block"></div>});
<a name="line678"></a><div class="linenumber">678</div><div style="width:12em;display:inline-block"></div>}
<a name="line679"></a><div class="linenumber">679</div><div style="width:12em;display:inline-block"></div>else&nbsp;{
<a name="line680"></a><div class="linenumber">680</div><div style="width:14em;display:inline-block"></div>asyncCallback(null);
<a name="line681"></a><div class="linenumber">681</div><div style="width:12em;display:inline-block"></div>}
<a name="line682"></a><div class="linenumber">682</div><div style="width:10em;display:inline-block"></div>},
<a name="line683"></a><div class="linenumber">683</div>
<a name="line684"></a><div class="linenumber">684</div><div style="width:10em;display:inline-block"></div>function(asyncCallback)&nbsp;{
<a name="line685"></a><div class="linenumber">685</div><div style="width:12em;display:inline-block"></div>pub.events.emit("emitEasyrtcMsg",&nbsp;targetConnectionObj,&nbsp;msg.msgType,&nbsp;outgoingMsg,&nbsp;null,&nbsp;asyncCallback);
<a name="line686"></a><div class="linenumber">686</div><div style="width:10em;display:inline-block"></div>}
<a name="line687"></a><div class="linenumber">687</div>
<a name="line688"></a><div class="linenumber">688</div><div style="width:8em;display:inline-block"></div>],
<a name="line689"></a><div class="linenumber">689</div><div style="width:8em;display:inline-block"></div>function&nbsp;(err)&nbsp;{
<a name="line690"></a><div class="linenumber">690</div><div style="width:10em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line691"></a><div class="linenumber">691</div><div style="width:12em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;pub.util.getErrorMsg("MSG_REJECT_GEN_FAIL"),&nbsp;appObj);
<a name="line692"></a><div class="linenumber">692</div><div style="width:12em;display:inline-block"></div>pub.util.logError("["+connectionObj.getEasyrtcid()+"]&nbsp;General&nbsp;message&nbsp;error.&nbsp;Message&nbsp;ignored.",&nbsp;err);
<a name="line693"></a><div class="linenumber">693</div><div style="width:10em;display:inline-block"></div>}&nbsp;else&nbsp;{
<a name="line694"></a><div class="linenumber">694</div><div style="width:12em;display:inline-block"></div>pub.util.sendSocketCallbackAck(easyrtcid,&nbsp;socketCallback,&nbsp;appObj);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
<a name="line695"></a><div class="linenumber">695</div><div style="width:8em;display:inline-block"></div>});
<a name="line696"></a><div class="linenumber">696</div><div style="width:6em;display:inline-block"></div>}
<a name="line697"></a><div class="linenumber">697</div>
<a name="line698"></a><div class="linenumber">698</div><div style="width:6em;display:inline-block"></div>else&nbsp;if&nbsp;(msg.targetRoom)&nbsp;{
<a name="line699"></a><div class="linenumber">699</div><div style="width:8em;display:inline-block"></div>//&nbsp;Relay&nbsp;a&nbsp;message&nbsp;to&nbsp;one&nbsp;or&nbsp;more&nbsp;clients&nbsp;in&nbsp;a&nbsp;room
<a name="line700"></a><div class="linenumber">700</div>
<a name="line701"></a><div class="linenumber">701</div><div style="width:8em;display:inline-block"></div>var&nbsp;outgoingMsg&nbsp;=&nbsp;{
<a name="line702"></a><div class="linenumber">702</div><div style="width:10em;display:inline-block"></div>senderEasyrtcid:&nbsp;connectionObj.getEasyrtcid(),
<a name="line703"></a><div class="linenumber">703</div><div style="width:10em;display:inline-block"></div>targetRoom:&nbsp;msg.targetRoom,
<a name="line704"></a><div class="linenumber">704</div><div style="width:10em;display:inline-block"></div>msgType:&nbsp;msg.msgType,
<a name="line705"></a><div class="linenumber">705</div><div style="width:10em;display:inline-block"></div>msgData:&nbsp;msg.msgData
<a name="line706"></a><div class="linenumber">706</div><div style="width:8em;display:inline-block"></div>};
<a name="line707"></a><div class="linenumber">707</div>
<a name="line708"></a><div class="linenumber">708</div><div style="width:8em;display:inline-block"></div>var&nbsp;targetRoomObj&nbsp;=&nbsp;null;
<a name="line709"></a><div class="linenumber">709</div>
<a name="line710"></a><div class="linenumber">710</div><div style="width:8em;display:inline-block"></div>async.waterfall([
<a name="line711"></a><div class="linenumber">711</div><div style="width:10em;display:inline-block"></div>function(asyncCallback){
<a name="line712"></a><div class="linenumber">712</div><div style="width:12em;display:inline-block"></div>//&nbsp;get&nbsp;room&nbsp;object
<a name="line713"></a><div class="linenumber">713</div><div style="width:12em;display:inline-block"></div>connectionObj.getApp().room(msg.targetRoom,&nbsp;asyncCallback);
<a name="line714"></a><div class="linenumber">714</div><div style="width:10em;display:inline-block"></div>},
<a name="line715"></a><div class="linenumber">715</div>
<a name="line716"></a><div class="linenumber">716</div><div style="width:10em;display:inline-block"></div>function(newTargetRoomObj,&nbsp;asyncCallback)&nbsp;{
<a name="line717"></a><div class="linenumber">717</div><div style="width:12em;display:inline-block"></div>targetRoomObj&nbsp;=&nbsp;newTargetRoomObj;
<a name="line718"></a><div class="linenumber">718</div>
<a name="line719"></a><div class="linenumber">719</div><div style="width:12em;display:inline-block"></div>//&nbsp;get&nbsp;list&nbsp;of&nbsp;connections&nbsp;in&nbsp;the&nbsp;room
<a name="line720"></a><div class="linenumber">720</div><div style="width:12em;display:inline-block"></div>targetRoomObj.getConnections(asyncCallback);
<a name="line721"></a><div class="linenumber">721</div><div style="width:10em;display:inline-block"></div>},
<a name="line722"></a><div class="linenumber">722</div>
<a name="line723"></a><div class="linenumber">723</div><div style="width:10em;display:inline-block"></div>function(connectedEasyrtcidArray,&nbsp;asyncCallback)&nbsp;{
<a name="line724"></a><div class="linenumber">724</div><div style="width:12em;display:inline-block"></div>for&nbsp;(var&nbsp;i&nbsp;=&nbsp;0;&nbsp;i&nbsp;&lt;&nbsp;connectedEasyrtcidArray.length;&nbsp;i++)&nbsp;{
<a name="line725"></a><div class="linenumber">725</div><div style="width:14em;display:inline-block"></div>//&nbsp;Stop&nbsp;client&nbsp;from&nbsp;sending&nbsp;message&nbsp;to&nbsp;themselves
<a name="line726"></a><div class="linenumber">726</div><div style="width:14em;display:inline-block"></div>if&nbsp;(connectedEasyrtcidArray[i]&nbsp;==&nbsp;connectionObj.getEasyrtcid())&nbsp;{
<a name="line727"></a><div class="linenumber">727</div><div style="width:16em;display:inline-block"></div>continue;
<a name="line728"></a><div class="linenumber">728</div><div style="width:14em;display:inline-block"></div>}
<a name="line729"></a><div class="linenumber">729</div>
<a name="line730"></a><div class="linenumber">730</div><div style="width:14em;display:inline-block"></div>connectionObj.getApp().connection(connectedEasyrtcidArray[i],&nbsp;function(err,&nbsp;targetConnectionObj){
<a name="line731"></a><div class="linenumber">731</div><div style="width:16em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line732"></a><div class="linenumber">732</div><div style="width:18em;display:inline-block"></div>return;
<a name="line733"></a><div class="linenumber">733</div><div style="width:16em;display:inline-block"></div>}
<a name="line734"></a><div class="linenumber">734</div>
<a name="line735"></a><div class="linenumber">735</div><div style="width:16em;display:inline-block"></div>//&nbsp;Do&nbsp;we&nbsp;limit&nbsp;by&nbsp;group?&nbsp;If&nbsp;not&nbsp;the&nbsp;message&nbsp;goes&nbsp;out&nbsp;to&nbsp;all&nbsp;in&nbsp;room
<a name="line736"></a><div class="linenumber">736</div><div style="width:16em;display:inline-block"></div>if(msg.targetGroup)&nbsp;{
<a name="line737"></a><div class="linenumber">737</div><div style="width:18em;display:inline-block"></div>targetConnectionObj.isInGroup(msg.targetGroup,&nbsp;function(err,&nbsp;isAllowed){
<a name="line738"></a><div class="linenumber">738</div><div style="width:20em;display:inline-block"></div>if&nbsp;(isAllowed)&nbsp;{
<a name="line739"></a><div class="linenumber">739</div><div style="width:22em;display:inline-block"></div>pub.events.emit("emitEasyrtcMsg",&nbsp;targetConnectionObj,&nbsp;msg.msgType,&nbsp;outgoingMsg,&nbsp;null,&nbsp;pub.util.nextToNowhere);
<a name="line740"></a><div class="linenumber">740</div><div style="width:20em;display:inline-block"></div>}
<a name="line741"></a><div class="linenumber">741</div><div style="width:18em;display:inline-block"></div>});
<a name="line742"></a><div class="linenumber">742</div><div style="width:16em;display:inline-block"></div>}
<a name="line743"></a><div class="linenumber">743</div><div style="width:16em;display:inline-block"></div>else&nbsp;{
<a name="line744"></a><div class="linenumber">744</div><div style="width:18em;display:inline-block"></div>pub.events.emit("emitEasyrtcMsg",&nbsp;targetConnectionObj,&nbsp;msg.msgType,&nbsp;outgoingMsg,&nbsp;null,&nbsp;pub.util.nextToNowhere);
<a name="line745"></a><div class="linenumber">745</div><div style="width:16em;display:inline-block"></div>}
<a name="line746"></a><div class="linenumber">746</div><div style="width:14em;display:inline-block"></div>});
<a name="line747"></a><div class="linenumber">747</div><div style="width:12em;display:inline-block"></div>}
<a name="line748"></a><div class="linenumber">748</div><div style="width:12em;display:inline-block"></div>asyncCallback(null);
<a name="line749"></a><div class="linenumber">749</div><div style="width:10em;display:inline-block"></div>}
<a name="line750"></a><div class="linenumber">750</div><div style="width:8em;display:inline-block"></div>],
<a name="line751"></a><div class="linenumber">751</div><div style="width:8em;display:inline-block"></div>function(err)&nbsp;{
<a name="line752"></a><div class="linenumber">752</div><div style="width:10em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line753"></a><div class="linenumber">753</div><div style="width:12em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;pub.util.getErrorMsg("MSG_REJECT_TARGET_ROOM"),&nbsp;appObj);
<a name="line754"></a><div class="linenumber">754</div><div style="width:10em;display:inline-block"></div>}
<a name="line755"></a><div class="linenumber">755</div><div style="width:10em;display:inline-block"></div>else&nbsp;{
<a name="line756"></a><div class="linenumber">756</div><div style="width:12em;display:inline-block"></div>pub.util.sendSocketCallbackAck(easyrtcid,&nbsp;socketCallback,&nbsp;appObj);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
<a name="line757"></a><div class="linenumber">757</div><div style="width:8em;display:inline-block"></div>});
<a name="line758"></a><div class="linenumber">758</div>
<a name="line759"></a><div class="linenumber">759</div><div style="width:6em;display:inline-block"></div>}
<a name="line760"></a><div class="linenumber">760</div>
<a name="line761"></a><div class="linenumber">761</div><div style="width:6em;display:inline-block"></div>else&nbsp;if&nbsp;(msg.targetGroup)&nbsp;{
<a name="line762"></a><div class="linenumber">762</div><div style="width:8em;display:inline-block"></div>//&nbsp;Relay&nbsp;a&nbsp;message&nbsp;to&nbsp;one&nbsp;or&nbsp;more&nbsp;clients&nbsp;in&nbsp;a&nbsp;group
<a name="line763"></a><div class="linenumber">763</div><div style="width:8em;display:inline-block"></div>var&nbsp;targetGroupObj&nbsp;=&nbsp;null;
<a name="line764"></a><div class="linenumber">764</div>
<a name="line765"></a><div class="linenumber">765</div><div style="width:8em;display:inline-block"></div>var&nbsp;outgoingMsg&nbsp;=&nbsp;{
<a name="line766"></a><div class="linenumber">766</div><div style="width:10em;display:inline-block"></div>senderEasyrtcid:&nbsp;connectionObj.getEasyrtcid(),
<a name="line767"></a><div class="linenumber">767</div><div style="width:10em;display:inline-block"></div>targetGroup:&nbsp;msg.targetGroup,
<a name="line768"></a><div class="linenumber">768</div><div style="width:10em;display:inline-block"></div>msgType:&nbsp;msg.msgType,
<a name="line769"></a><div class="linenumber">769</div><div style="width:10em;display:inline-block"></div>msgData:&nbsp;msg.msgData
<a name="line770"></a><div class="linenumber">770</div><div style="width:8em;display:inline-block"></div>};
<a name="line771"></a><div class="linenumber">771</div>
<a name="line772"></a><div class="linenumber">772</div><div style="width:8em;display:inline-block"></div>async.waterfall([
<a name="line773"></a><div class="linenumber">773</div><div style="width:10em;display:inline-block"></div>function(asyncCallback){
<a name="line774"></a><div class="linenumber">774</div><div style="width:12em;display:inline-block"></div>//&nbsp;get&nbsp;group&nbsp;object
<a name="line775"></a><div class="linenumber">775</div><div style="width:12em;display:inline-block"></div>connectionObj.getApp().group(msg.targetGroup,&nbsp;asyncCallback);
<a name="line776"></a><div class="linenumber">776</div><div style="width:10em;display:inline-block"></div>},
<a name="line777"></a><div class="linenumber">777</div>
<a name="line778"></a><div class="linenumber">778</div><div style="width:10em;display:inline-block"></div>function(newTargetGroupObj,&nbsp;asyncCallback)&nbsp;{
<a name="line779"></a><div class="linenumber">779</div><div style="width:12em;display:inline-block"></div>targetGroupObj&nbsp;=&nbsp;newTargetGroupObj;
<a name="line780"></a><div class="linenumber">780</div>
<a name="line781"></a><div class="linenumber">781</div><div style="width:12em;display:inline-block"></div>//&nbsp;get&nbsp;list&nbsp;of&nbsp;connections&nbsp;in&nbsp;the&nbsp;group
<a name="line782"></a><div class="linenumber">782</div><div style="width:12em;display:inline-block"></div>targetGroupObj.getConnections(asyncCallback);
<a name="line783"></a><div class="linenumber">783</div><div style="width:10em;display:inline-block"></div>},
<a name="line784"></a><div class="linenumber">784</div>
<a name="line785"></a><div class="linenumber">785</div><div style="width:10em;display:inline-block"></div>function(connectedEasyrtcidArray,&nbsp;asyncCallback)&nbsp;{
<a name="line786"></a><div class="linenumber">786</div><div style="width:12em;display:inline-block"></div>for&nbsp;(var&nbsp;i&nbsp;=&nbsp;0;&nbsp;i&nbsp;&lt;&nbsp;connectedEasyrtcidArray.length;&nbsp;i++)&nbsp;{
<a name="line787"></a><div class="linenumber">787</div><div style="width:14em;display:inline-block"></div>//&nbsp;Stop&nbsp;client&nbsp;from&nbsp;sending&nbsp;message&nbsp;to&nbsp;themselves
<a name="line788"></a><div class="linenumber">788</div><div style="width:14em;display:inline-block"></div>if&nbsp;(connectedEasyrtcidArray[i]&nbsp;==&nbsp;connectionObj.getEasyrtcid())&nbsp;{
<a name="line789"></a><div class="linenumber">789</div><div style="width:16em;display:inline-block"></div>continue;
<a name="line790"></a><div class="linenumber">790</div><div style="width:14em;display:inline-block"></div>}
<a name="line791"></a><div class="linenumber">791</div>
<a name="line792"></a><div class="linenumber">792</div><div style="width:14em;display:inline-block"></div>connectionObj.getApp().connection(connectedEasyrtcidArray[i],&nbsp;function(err,&nbsp;targetConnectionObj){
<a name="line793"></a><div class="linenumber">793</div><div style="width:16em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line794"></a><div class="linenumber">794</div><div style="width:18em;display:inline-block"></div>return;
<a name="line795"></a><div class="linenumber">795</div><div style="width:16em;display:inline-block"></div>}
<a name="line796"></a><div class="linenumber">796</div><div style="width:16em;display:inline-block"></div>pub.events.emit("emitEasyrtcMsg",&nbsp;targetConnectionObj,&nbsp;msg.msgType,&nbsp;outgoingMsg,&nbsp;null,&nbsp;pub.util.nextToNowhere);
<a name="line797"></a><div class="linenumber">797</div><div style="width:14em;display:inline-block"></div>});
<a name="line798"></a><div class="linenumber">798</div><div style="width:12em;display:inline-block"></div>}
<a name="line799"></a><div class="linenumber">799</div><div style="width:12em;display:inline-block"></div>asyncCallback(null);
<a name="line800"></a><div class="linenumber">800</div><div style="width:10em;display:inline-block"></div>}
<a name="line801"></a><div class="linenumber">801</div><div style="width:8em;display:inline-block"></div>],
<a name="line802"></a><div class="linenumber">802</div><div style="width:8em;display:inline-block"></div>function(err)&nbsp;{
<a name="line803"></a><div class="linenumber">803</div><div style="width:10em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line804"></a><div class="linenumber">804</div><div style="width:12em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;pub.util.getErrorMsg("MSG_REJECT_TARGET_GROUP"),&nbsp;appObj);
<a name="line805"></a><div class="linenumber">805</div><div style="width:10em;display:inline-block"></div>}
<a name="line806"></a><div class="linenumber">806</div><div style="width:10em;display:inline-block"></div>else&nbsp;{
<a name="line807"></a><div class="linenumber">807</div><div style="width:12em;display:inline-block"></div>pub.util.sendSocketCallbackAck(easyrtcid,&nbsp;socketCallback,&nbsp;appObj);
<a name="line808"></a><div class="linenumber">808</div><div style="width:10em;display:inline-block"></div>}
<a name="line809"></a><div class="linenumber">809</div><div style="width:8em;display:inline-block"></div>});
<a name="line810"></a><div class="linenumber">810</div>
<a name="line811"></a><div class="linenumber">811</div><div style="width:6em;display:inline-block"></div>}
<a name="line812"></a><div class="linenumber">812</div><div style="width:6em;display:inline-block"></div>else&nbsp;{
<a name="line813"></a><div class="linenumber">813</div><div style="width:8em;display:inline-block"></div>pub.util.logWarning("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;EasyRTC&nbsp;message&nbsp;received&nbsp;without&nbsp;targetEasyrtcid&nbsp;or&nbsp;targetRoom",&nbsp;msg);
<a name="line814"></a><div class="linenumber">814</div><div style="width:8em;display:inline-block"></div>next(null);
<a name="line815"></a><div class="linenumber">815</div><div style="width:6em;display:inline-block"></div>}
<a name="line816"></a><div class="linenumber">816</div><div style="width:4em;display:inline-block"></div>}
<a name="line817"></a><div class="linenumber">817</div><div style="width:2em;display:inline-block"></div>],
<a name="line818"></a><div class="linenumber">818</div><div style="width:2em;display:inline-block"></div>function(err)&nbsp;{
<a name="line819"></a><div class="linenumber">819</div><div style="width:4em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line820"></a><div class="linenumber">820</div><div style="width:6em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;pub.util.getErrorMsg("MSG_REJECT_GEN_FAIL"),&nbsp;appObj);
<a name="line821"></a><div class="linenumber">821</div><div style="width:6em;display:inline-block"></div>pub.util.logError("["+connectionObj.getEasyrtcid()+"]&nbsp;General&nbsp;message&nbsp;error.&nbsp;Message&nbsp;ignored.",&nbsp;err);
<a name="line822"></a><div class="linenumber">822</div><div style="width:4em;display:inline-block"></div>}
<a name="line823"></a><div class="linenumber">823</div><div style="width:2em;display:inline-block"></div>});
<a name="line824"></a><div class="linenumber">824</div><div style="width:0em;display:inline-block"></div>};
<a name="line825"></a><div class="linenumber">825</div>
<a name="line826"></a><div class="linenumber">826</div>
<a name="line827"></a><div class="linenumber">827</div><div style="width:0em;display:inline-block"></div>/**
<a name="line828"></a><div class="linenumber">828</div><div style="width:0em;display:inline-block"></div>*&nbsp;Default&nbsp;listener&nbsp;for&nbsp;event&nbsp;"emitEasyrtcCmd".&nbsp;This&nbsp;event&nbsp;is&nbsp;fired&nbsp;when&nbsp;the&nbsp;server&nbsp;should&nbsp;emit&nbsp;an&nbsp;EasyRTC&nbsp;command&nbsp;to&nbsp;a&nbsp;client.
<a name="line829"></a><div class="linenumber">829</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line830"></a><div class="linenumber">830</div><div style="width:0em;display:inline-block"></div>*&nbsp;The&nbsp;easyrtcid&nbsp;and&nbsp;serverTime&nbsp;fields&nbsp;will&nbsp;be&nbsp;added&nbsp;to&nbsp;the&nbsp;msg&nbsp;automatically.
<a name="line831"></a><div class="linenumber">831</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line832"></a><div class="linenumber">832</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;connectionObj&nbsp;&nbsp;EasyRTC&nbsp;connection&nbsp;object.&nbsp;Contains&nbsp;methods&nbsp;used&nbsp;for&nbsp;identifying&nbsp;and&nbsp;managing&nbsp;a&nbsp;connection.
<a name="line833"></a><div class="linenumber">833</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{String}&nbsp;msgType&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Message&nbsp;type&nbsp;of&nbsp;the&nbsp;message.
<a name="line834"></a><div class="linenumber">834</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;msg&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Message&nbsp;object&nbsp;which&nbsp;contains&nbsp;the&nbsp;full&nbsp;message&nbsp;to&nbsp;a&nbsp;client;&nbsp;this&nbsp;can&nbsp;include&nbsp;the&nbsp;standard&nbsp;msgData&nbsp;field.
<a name="line835"></a><div class="linenumber">835</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Function}&nbsp;socketCallback&nbsp;Socket.io&nbsp;callback&nbsp;function&nbsp;which&nbsp;delivers&nbsp;a&nbsp;response&nbsp;to&nbsp;a&nbsp;socket.&nbsp;Expects&nbsp;a&nbsp;single&nbsp;parameter&nbsp;(msg).
<a name="line836"></a><div class="linenumber">836</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line837"></a><div class="linenumber">837</div><div style="width:0em;display:inline-block"></div>*/
<a name="line838"></a><div class="linenumber">838</div><div style="width:0em;display:inline-block"></div>eventListener.onEmitEasyrtcCmd&nbsp;=&nbsp;function(connectionObj,&nbsp;msgType,&nbsp;msg,&nbsp;socketCallback,&nbsp;next){
<a name="line839"></a><div class="linenumber">839</div><div style="width:2em;display:inline-block"></div>if&nbsp;(!_.isObject(connectionObj)){
<a name="line840"></a><div class="linenumber">840</div><div style="width:4em;display:inline-block"></div>next(new&nbsp;pub.util.ConnectionError("Connection&nbsp;object&nbsp;invalid.&nbsp;Client&nbsp;may&nbsp;have&nbsp;disconnected."));
<a name="line841"></a><div class="linenumber">841</div><div style="width:4em;display:inline-block"></div>return;
<a name="line842"></a><div class="linenumber">842</div><div style="width:2em;display:inline-block"></div>}
<a name="line843"></a><div class="linenumber">843</div>
<a name="line844"></a><div class="linenumber">844</div><div style="width:2em;display:inline-block"></div>var&nbsp;easyrtcid&nbsp;=&nbsp;connectionObj.getEasyrtcid();
<a name="line845"></a><div class="linenumber">845</div><div style="width:2em;display:inline-block"></div>var&nbsp;appName&nbsp;=&nbsp;connectionObj.getAppName();
<a name="line846"></a><div class="linenumber">846</div>
<a name="line847"></a><div class="linenumber">847</div><div style="width:2em;display:inline-block"></div>pub.util.logDebug("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;Running&nbsp;func&nbsp;'onEmitEasyrtcCmd'&nbsp;with&nbsp;msgType&nbsp;["+msgType+"]");
<a name="line848"></a><div class="linenumber">848</div><div style="width:2em;display:inline-block"></div>if&nbsp;(!msg)&nbsp;{
<a name="line849"></a><div class="linenumber">849</div><div style="width:4em;display:inline-block"></div>msg&nbsp;=&nbsp;{};
<a name="line850"></a><div class="linenumber">850</div><div style="width:2em;display:inline-block"></div>}
<a name="line851"></a><div class="linenumber">851</div><div style="width:2em;display:inline-block"></div>if(!_.isFunction(socketCallback))&nbsp;{
<a name="line852"></a><div class="linenumber">852</div><div style="width:4em;display:inline-block"></div>socketCallback&nbsp;=&nbsp;function(returnMsg)&nbsp;{
<a name="line853"></a><div class="linenumber">853</div><div style="width:6em;display:inline-block"></div>if&nbsp;(_.isObject(returnMsg)&nbsp;&amp;&amp;&nbsp;_.isString(returnMsg.msgType)&nbsp;&amp;&amp;&nbsp;returnMsg.msgType&nbsp;==&nbsp;"ack"){
<a name="line854"></a><div class="linenumber">854</div><div style="width:8em;display:inline-block"></div>//&nbsp;pub.util.logDebug("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;EasyRTC&nbsp;message:&nbsp;unhandled&nbsp;Ack&nbsp;return&nbsp;message.");
<a name="line855"></a><div class="linenumber">855</div><div style="width:6em;display:inline-block"></div>}
<a name="line856"></a><div class="linenumber">856</div><div style="width:6em;display:inline-block"></div>else&nbsp;{
<a name="line857"></a><div class="linenumber">857</div><div style="width:8em;display:inline-block"></div>pub.util.logDebug("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;EasyRTC&nbsp;message:&nbsp;unhandled&nbsp;return&nbsp;message.",&nbsp;returnMsg);
<a name="line858"></a><div class="linenumber">858</div><div style="width:6em;display:inline-block"></div>}
<a name="line859"></a><div class="linenumber">859</div><div style="width:4em;display:inline-block"></div>};
<a name="line860"></a><div class="linenumber">860</div><div style="width:2em;display:inline-block"></div>}
<a name="line861"></a><div class="linenumber">861</div>
<a name="line862"></a><div class="linenumber">862</div><div style="width:2em;display:inline-block"></div>msg.easyrtcid&nbsp;&nbsp;&nbsp;=&nbsp;connectionObj.getEasyrtcid();
<a name="line863"></a><div class="linenumber">863</div><div style="width:2em;display:inline-block"></div>msg.msgType&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;msgType;
<a name="line864"></a><div class="linenumber">864</div><div style="width:2em;display:inline-block"></div>msg.serverTime&nbsp;&nbsp;=&nbsp;Date.now();
<a name="line865"></a><div class="linenumber">865</div>
<a name="line866"></a><div class="linenumber">866</div><div style="width:2em;display:inline-block"></div>connectionObj.socket.emit(&nbsp;"easyrtcCmd",&nbsp;msg,&nbsp;socketCallback);
<a name="line867"></a><div class="linenumber">867</div>
<a name="line868"></a><div class="linenumber">868</div><div style="width:2em;display:inline-block"></div>if&nbsp;(pub.getOption("logMessagesEnable"))&nbsp;{
<a name="line869"></a><div class="linenumber">869</div><div style="width:4em;display:inline-block"></div>try&nbsp;{
<a name="line870"></a><div class="linenumber">870</div><div style="width:6em;display:inline-block"></div>pub.util.logDebug("["+appName+"]["+easyrtcid+"]&nbsp;Sending&nbsp;socket.io&nbsp;message:&nbsp;["+JSON.stringify(msg)+"]");
<a name="line871"></a><div class="linenumber">871</div><div style="width:4em;display:inline-block"></div>}
<a name="line872"></a><div class="linenumber">872</div><div style="width:4em;display:inline-block"></div>catch(err)&nbsp;{
<a name="line873"></a><div class="linenumber">873</div><div style="width:6em;display:inline-block"></div>pub.util.logDebug("["+appName+"]["+easyrtcid+"]&nbsp;Sending&nbsp;socket.io&nbsp;message");
<a name="line874"></a><div class="linenumber">874</div><div style="width:4em;display:inline-block"></div>}
<a name="line875"></a><div class="linenumber">875</div><div style="width:2em;display:inline-block"></div>}
<a name="line876"></a><div class="linenumber">876</div>
<a name="line877"></a><div class="linenumber">877</div><div style="width:2em;display:inline-block"></div>next(null);
<a name="line878"></a><div class="linenumber">878</div><div style="width:0em;display:inline-block"></div>};
<a name="line879"></a><div class="linenumber">879</div>
<a name="line880"></a><div class="linenumber">880</div>
<a name="line881"></a><div class="linenumber">881</div><div style="width:0em;display:inline-block"></div>/**
<a name="line882"></a><div class="linenumber">882</div><div style="width:0em;display:inline-block"></div>*&nbsp;Default&nbsp;listener&nbsp;for&nbsp;event&nbsp;"emitEasyrtcMsg".&nbsp;This&nbsp;event&nbsp;is&nbsp;fired&nbsp;when&nbsp;the&nbsp;server&nbsp;should&nbsp;emit&nbsp;an&nbsp;EasyRTC&nbsp;message&nbsp;to&nbsp;a&nbsp;client.
<a name="line883"></a><div class="linenumber">883</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line884"></a><div class="linenumber">884</div><div style="width:0em;display:inline-block"></div>*&nbsp;The&nbsp;easyrtcid&nbsp;and&nbsp;serverTime&nbsp;fields&nbsp;will&nbsp;be&nbsp;added&nbsp;to&nbsp;the&nbsp;msg&nbsp;automatically.
<a name="line885"></a><div class="linenumber">885</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line886"></a><div class="linenumber">886</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;connectionObj&nbsp;&nbsp;EasyRTC&nbsp;connection&nbsp;object.&nbsp;Contains&nbsp;methods&nbsp;used&nbsp;for&nbsp;identifying&nbsp;and&nbsp;managing&nbsp;a&nbsp;connection.
<a name="line887"></a><div class="linenumber">887</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{String}&nbsp;msgType&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Message&nbsp;type&nbsp;of&nbsp;the&nbsp;message.
<a name="line888"></a><div class="linenumber">888</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;msg&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Message&nbsp;object&nbsp;which&nbsp;contains&nbsp;the&nbsp;full&nbsp;message&nbsp;to&nbsp;a&nbsp;client;&nbsp;this&nbsp;can&nbsp;include&nbsp;the&nbsp;standard&nbsp;msgData&nbsp;field.
<a name="line889"></a><div class="linenumber">889</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Function}&nbsp;socketCallback&nbsp;Socket.io&nbsp;callback&nbsp;function&nbsp;which&nbsp;delivers&nbsp;a&nbsp;response&nbsp;to&nbsp;a&nbsp;socket.&nbsp;Expects&nbsp;a&nbsp;single&nbsp;parameter&nbsp;(msg).
<a name="line890"></a><div class="linenumber">890</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line891"></a><div class="linenumber">891</div><div style="width:0em;display:inline-block"></div>*/
<a name="line892"></a><div class="linenumber">892</div><div style="width:0em;display:inline-block"></div>eventListener.onEmitEasyrtcMsg&nbsp;=&nbsp;function(connectionObj,&nbsp;msgType,&nbsp;msg,&nbsp;socketCallback,&nbsp;next){
<a name="line893"></a><div class="linenumber">893</div><div style="width:2em;display:inline-block"></div>if&nbsp;(!_.isObject(connectionObj)){
<a name="line894"></a><div class="linenumber">894</div><div style="width:4em;display:inline-block"></div>next(new&nbsp;pub.util.ConnectionError("Connection&nbsp;object&nbsp;invalid.&nbsp;Client&nbsp;may&nbsp;have&nbsp;disconnected."));
<a name="line895"></a><div class="linenumber">895</div><div style="width:4em;display:inline-block"></div>return;
<a name="line896"></a><div class="linenumber">896</div><div style="width:2em;display:inline-block"></div>}
<a name="line897"></a><div class="linenumber">897</div>
<a name="line898"></a><div class="linenumber">898</div><div style="width:2em;display:inline-block"></div>var&nbsp;easyrtcid&nbsp;=&nbsp;connectionObj.getEasyrtcid();
<a name="line899"></a><div class="linenumber">899</div><div style="width:2em;display:inline-block"></div>var&nbsp;appName&nbsp;=&nbsp;connectionObj.getAppName();
<a name="line900"></a><div class="linenumber">900</div>
<a name="line901"></a><div class="linenumber">901</div><div style="width:2em;display:inline-block"></div>pub.util.logDebug("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;Running&nbsp;func&nbsp;'onEmitEasyrtcMsg'&nbsp;with&nbsp;msgType&nbsp;["+msgType+"]");
<a name="line902"></a><div class="linenumber">902</div>
<a name="line903"></a><div class="linenumber">903</div>
<a name="line904"></a><div class="linenumber">904</div><div style="width:2em;display:inline-block"></div>if&nbsp;(!msg)&nbsp;{
<a name="line905"></a><div class="linenumber">905</div><div style="width:4em;display:inline-block"></div>msg&nbsp;=&nbsp;{};
<a name="line906"></a><div class="linenumber">906</div><div style="width:2em;display:inline-block"></div>}
<a name="line907"></a><div class="linenumber">907</div><div style="width:2em;display:inline-block"></div>if(!_.isFunction(socketCallback))&nbsp;{
<a name="line908"></a><div class="linenumber">908</div><div style="width:4em;display:inline-block"></div>socketCallback&nbsp;=&nbsp;function(returnMsg)&nbsp;{
<a name="line909"></a><div class="linenumber">909</div><div style="width:6em;display:inline-block"></div>if&nbsp;(_.isObject(returnMsg)&nbsp;&amp;&amp;&nbsp;_.isString(returnMsg.msgType)&nbsp;&amp;&amp;&nbsp;returnMsg.msgType&nbsp;==&nbsp;"ack"){
<a name="line910"></a><div class="linenumber">910</div><div style="width:8em;display:inline-block"></div>//&nbsp;pub.util.logDebug("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;EasyRTC&nbsp;message:&nbsp;unhandled&nbsp;Ack&nbsp;return&nbsp;message.");
<a name="line911"></a><div class="linenumber">911</div><div style="width:6em;display:inline-block"></div>}
<a name="line912"></a><div class="linenumber">912</div><div style="width:6em;display:inline-block"></div>else&nbsp;{
<a name="line913"></a><div class="linenumber">913</div><div style="width:8em;display:inline-block"></div>pub.util.logDebug("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;EasyRTC&nbsp;message:&nbsp;unhandled&nbsp;return&nbsp;message.",&nbsp;returnMsg);
<a name="line914"></a><div class="linenumber">914</div><div style="width:6em;display:inline-block"></div>}
<a name="line915"></a><div class="linenumber">915</div><div style="width:4em;display:inline-block"></div>};
<a name="line916"></a><div class="linenumber">916</div><div style="width:2em;display:inline-block"></div>}
<a name="line917"></a><div class="linenumber">917</div><div style="width:2em;display:inline-block"></div>msg.easyrtcid&nbsp;&nbsp;&nbsp;=&nbsp;connectionObj.getEasyrtcid();
<a name="line918"></a><div class="linenumber">918</div><div style="width:2em;display:inline-block"></div>msg.msgType&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;msgType;
<a name="line919"></a><div class="linenumber">919</div><div style="width:2em;display:inline-block"></div>msg.serverTime&nbsp;&nbsp;=&nbsp;Date.now();
<a name="line920"></a><div class="linenumber">920</div>
<a name="line921"></a><div class="linenumber">921</div><div style="width:2em;display:inline-block"></div>connectionObj.socket.emit(&nbsp;"easyrtcMsg",&nbsp;msg,&nbsp;socketCallback);
<a name="line922"></a><div class="linenumber">922</div>
<a name="line923"></a><div class="linenumber">923</div><div style="width:2em;display:inline-block"></div>if&nbsp;(pub.getOption("logMessagesEnable"))&nbsp;{
<a name="line924"></a><div class="linenumber">924</div><div style="width:4em;display:inline-block"></div>try&nbsp;{
<a name="line925"></a><div class="linenumber">925</div><div style="width:6em;display:inline-block"></div>pub.util.logDebug("["+appName+"]["+easyrtcid+"]&nbsp;Sending&nbsp;socket.io&nbsp;message:&nbsp;["+JSON.stringify(msg)+"]");
<a name="line926"></a><div class="linenumber">926</div><div style="width:4em;display:inline-block"></div>}
<a name="line927"></a><div class="linenumber">927</div><div style="width:4em;display:inline-block"></div>catch(err)&nbsp;{
<a name="line928"></a><div class="linenumber">928</div><div style="width:6em;display:inline-block"></div>pub.util.logDebug("["+appName+"]["+easyrtcid+"]&nbsp;Sending&nbsp;socket.io&nbsp;message");
<a name="line929"></a><div class="linenumber">929</div><div style="width:4em;display:inline-block"></div>}
<a name="line930"></a><div class="linenumber">930</div><div style="width:2em;display:inline-block"></div>}
<a name="line931"></a><div class="linenumber">931</div>
<a name="line932"></a><div class="linenumber">932</div><div style="width:2em;display:inline-block"></div>next(null);
<a name="line933"></a><div class="linenumber">933</div><div style="width:0em;display:inline-block"></div>};
<a name="line934"></a><div class="linenumber">934</div>
<a name="line935"></a><div class="linenumber">935</div>
<a name="line936"></a><div class="linenumber">936</div><div style="width:0em;display:inline-block"></div>/**
<a name="line937"></a><div class="linenumber">937</div><div style="width:0em;display:inline-block"></div>*&nbsp;Default&nbsp;listener&nbsp;for&nbsp;event&nbsp;"emitError".&nbsp;This&nbsp;event&nbsp;is&nbsp;fired&nbsp;when&nbsp;the&nbsp;server&nbsp;should&nbsp;emit&nbsp;an&nbsp;EasyRTC&nbsp;error&nbsp;to&nbsp;a&nbsp;client.
<a name="line938"></a><div class="linenumber">938</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line939"></a><div class="linenumber">939</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;connectionObj&nbsp;&nbsp;EasyRTC&nbsp;connection&nbsp;object.&nbsp;Contains&nbsp;methods&nbsp;used&nbsp;for&nbsp;identifying&nbsp;and&nbsp;managing&nbsp;a&nbsp;connection.
<a name="line940"></a><div class="linenumber">940</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{String}&nbsp;errorCode&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EasyRTC&nbsp;error&nbsp;code&nbsp;associated&nbsp;with&nbsp;an&nbsp;error.
<a name="line941"></a><div class="linenumber">941</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Function}&nbsp;socketCallback&nbsp;Socket.io&nbsp;callback&nbsp;function&nbsp;which&nbsp;delivers&nbsp;a&nbsp;response&nbsp;to&nbsp;a&nbsp;socket.&nbsp;Expects&nbsp;a&nbsp;single&nbsp;parameter&nbsp;(msg).
<a name="line942"></a><div class="linenumber">942</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line943"></a><div class="linenumber">943</div><div style="width:0em;display:inline-block"></div>*/
<a name="line944"></a><div class="linenumber">944</div><div style="width:0em;display:inline-block"></div>eventListener.onEmitError&nbsp;=&nbsp;function(connectionObj,&nbsp;errorCode,&nbsp;socketCallback,&nbsp;next){
<a name="line945"></a><div class="linenumber">945</div><div style="width:2em;display:inline-block"></div>pub.util.logDebug("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;Running&nbsp;func&nbsp;'onEmitError'");
<a name="line946"></a><div class="linenumber">946</div><div style="width:2em;display:inline-block"></div>if(!_.isFunction(socketCallback))&nbsp;{
<a name="line947"></a><div class="linenumber">947</div><div style="width:4em;display:inline-block"></div>socketCallback&nbsp;=&nbsp;function(returnMsg)&nbsp;{
<a name="line948"></a><div class="linenumber">948</div><div style="width:6em;display:inline-block"></div>pub.util.logDebug("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;EasyRTC&nbsp;info:&nbsp;unhandled&nbsp;ACK&nbsp;return&nbsp;message.",&nbsp;returnMsg);
<a name="line949"></a><div class="linenumber">949</div><div style="width:4em;display:inline-block"></div>};
<a name="line950"></a><div class="linenumber">950</div><div style="width:2em;display:inline-block"></div>}
<a name="line951"></a><div class="linenumber">951</div><div style="width:2em;display:inline-block"></div>if(!_.isFunction(next))&nbsp;{
<a name="line952"></a><div class="linenumber">952</div><div style="width:4em;display:inline-block"></div>next&nbsp;=&nbsp;pub.util.nextToNowhere;
<a name="line953"></a><div class="linenumber">953</div><div style="width:2em;display:inline-block"></div>}
<a name="line954"></a><div class="linenumber">954</div>
<a name="line955"></a><div class="linenumber">955</div><div style="width:2em;display:inline-block"></div>pub.events.emit("emitEasyrtcCmd",&nbsp;connectionObj,&nbsp;"error",&nbsp;pub.util.getErrorMsg(errorCode),&nbsp;socketCallback,&nbsp;next);
<a name="line956"></a><div class="linenumber">956</div><div style="width:0em;display:inline-block"></div>};
<a name="line957"></a><div class="linenumber">957</div>
<a name="line958"></a><div class="linenumber">958</div>
<a name="line959"></a><div class="linenumber">959</div><div style="width:0em;display:inline-block"></div>/**
<a name="line960"></a><div class="linenumber">960</div><div style="width:0em;display:inline-block"></div>*&nbsp;Default&nbsp;listener&nbsp;for&nbsp;event&nbsp;"emitReturnAck".&nbsp;This&nbsp;event&nbsp;is&nbsp;fired&nbsp;when&nbsp;the&nbsp;server&nbsp;should&nbsp;return&nbsp;an&nbsp;Ack&nbsp;to&nbsp;a&nbsp;client&nbsp;via&nbsp;an&nbsp;acknowledgment&nbsp;message.
<a name="line961"></a><div class="linenumber">961</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line962"></a><div class="linenumber">962</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;connectionObj&nbsp;&nbsp;EasyRTC&nbsp;connection&nbsp;object.&nbsp;Contains&nbsp;methods&nbsp;used&nbsp;for&nbsp;identifying&nbsp;and&nbsp;managing&nbsp;a&nbsp;connection.
<a name="line963"></a><div class="linenumber">963</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Function}&nbsp;socketCallback&nbsp;Socket.io&nbsp;callback&nbsp;function&nbsp;which&nbsp;delivers&nbsp;a&nbsp;response&nbsp;to&nbsp;a&nbsp;socket.&nbsp;Expects&nbsp;a&nbsp;single&nbsp;parameter&nbsp;(msg).
<a name="line964"></a><div class="linenumber">964</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line965"></a><div class="linenumber">965</div><div style="width:0em;display:inline-block"></div>*/
<a name="line966"></a><div class="linenumber">966</div><div style="width:0em;display:inline-block"></div>eventListener.onEmitReturnAck&nbsp;=&nbsp;function(connectionObj,&nbsp;socketCallback,&nbsp;next){
<a name="line967"></a><div class="linenumber">967</div><div style="width:2em;display:inline-block"></div>var&nbsp;easyrtcid&nbsp;=&nbsp;connectionObj.getEasyrtcid();
<a name="line968"></a><div class="linenumber">968</div><div style="width:2em;display:inline-block"></div>var&nbsp;appObj&nbsp;=&nbsp;connectionObj.getApp();
<a name="line969"></a><div class="linenumber">969</div>
<a name="line970"></a><div class="linenumber">970</div><div style="width:2em;display:inline-block"></div>pub.util.logDebug("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;Running&nbsp;func&nbsp;'onEmitReturnAck'");
<a name="line971"></a><div class="linenumber">971</div><div style="width:2em;display:inline-block"></div>if(!_.isFunction(socketCallback))&nbsp;{
<a name="line972"></a><div class="linenumber">972</div><div style="width:4em;display:inline-block"></div>pub.util.logWarning("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;EasyRTC:&nbsp;unable&nbsp;to&nbsp;return&nbsp;ack&nbsp;to&nbsp;socket.");
<a name="line973"></a><div class="linenumber">973</div><div style="width:4em;display:inline-block"></div>return;
<a name="line974"></a><div class="linenumber">974</div><div style="width:2em;display:inline-block"></div>}
<a name="line975"></a><div class="linenumber">975</div><div style="width:2em;display:inline-block"></div>if(!_.isFunction(next))&nbsp;{
<a name="line976"></a><div class="linenumber">976</div><div style="width:4em;display:inline-block"></div>next&nbsp;=&nbsp;pub.util.nextToNowhere;
<a name="line977"></a><div class="linenumber">977</div><div style="width:2em;display:inline-block"></div>}
<a name="line978"></a><div class="linenumber">978</div>
<a name="line979"></a><div class="linenumber">979</div><div style="width:2em;display:inline-block"></div>var&nbsp;msg&nbsp;=&nbsp;{
<a name="line980"></a><div class="linenumber">980</div><div style="width:4em;display:inline-block"></div>msgType:&nbsp;"ack",
<a name="line981"></a><div class="linenumber">981</div><div style="width:4em;display:inline-block"></div>msgData:{}
<a name="line982"></a><div class="linenumber">982</div><div style="width:2em;display:inline-block"></div>};
<a name="line983"></a><div class="linenumber">983</div>
<a name="line984"></a><div class="linenumber">984</div><div style="width:2em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;msg,&nbsp;appObj);
<a name="line985"></a><div class="linenumber">985</div>
<a name="line986"></a><div class="linenumber">986</div><div style="width:2em;display:inline-block"></div>next(null);
<a name="line987"></a><div class="linenumber">987</div><div style="width:0em;display:inline-block"></div>};
<a name="line988"></a><div class="linenumber">988</div>
<a name="line989"></a><div class="linenumber">989</div>
<a name="line990"></a><div class="linenumber">990</div><div style="width:0em;display:inline-block"></div>/**
<a name="line991"></a><div class="linenumber">991</div><div style="width:0em;display:inline-block"></div>*&nbsp;Default&nbsp;listener&nbsp;for&nbsp;event&nbsp;"emitReturnError".&nbsp;This&nbsp;event&nbsp;is&nbsp;fired&nbsp;when&nbsp;the&nbsp;server&nbsp;should&nbsp;return&nbsp;an&nbsp;Error&nbsp;to&nbsp;a&nbsp;client&nbsp;via&nbsp;an&nbsp;acknowledgment&nbsp;message.
<a name="line992"></a><div class="linenumber">992</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line993"></a><div class="linenumber">993</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;connectionObj&nbsp;&nbsp;EasyRTC&nbsp;connection&nbsp;object.&nbsp;Contains&nbsp;methods&nbsp;used&nbsp;for&nbsp;identifying&nbsp;and&nbsp;managing&nbsp;a&nbsp;connection.
<a name="line994"></a><div class="linenumber">994</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Function}&nbsp;socketCallback&nbsp;Socket.io&nbsp;callback&nbsp;function&nbsp;which&nbsp;delivers&nbsp;a&nbsp;response&nbsp;to&nbsp;a&nbsp;socket.&nbsp;Expects&nbsp;a&nbsp;single&nbsp;parameter&nbsp;(msg).
<a name="line995"></a><div class="linenumber">995</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{String}&nbsp;errorCode&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EasyRTC&nbsp;error&nbsp;code&nbsp;associated&nbsp;with&nbsp;an&nbsp;error.
<a name="line996"></a><div class="linenumber">996</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line997"></a><div class="linenumber">997</div><div style="width:0em;display:inline-block"></div>*/
<a name="line998"></a><div class="linenumber">998</div><div style="width:0em;display:inline-block"></div>eventListener.onEmitReturnError&nbsp;=&nbsp;function(connectionObj,&nbsp;socketCallback,&nbsp;errorCode,&nbsp;next){
<a name="line999"></a><div class="linenumber">999</div><div style="width:2em;display:inline-block"></div>var&nbsp;easyrtcid&nbsp;=&nbsp;connectionObj.getEasyrtcid();
<a name="line1000"></a><div class="linenumber">1000</div><div style="width:2em;display:inline-block"></div>var&nbsp;appObj&nbsp;=&nbsp;connectionObj.getApp();
<a name="line1001"></a><div class="linenumber">1001</div>
<a name="line1002"></a><div class="linenumber">1002</div><div style="width:2em;display:inline-block"></div>pub.util.logDebug("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;Running&nbsp;func&nbsp;'onEmitReturnError'");
<a name="line1003"></a><div class="linenumber">1003</div><div style="width:2em;display:inline-block"></div>if(!_.isFunction(socketCallback))&nbsp;{
<a name="line1004"></a><div class="linenumber">1004</div><div style="width:4em;display:inline-block"></div>pub.util.logWarning("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;EasyRTC:&nbsp;unable&nbsp;to&nbsp;return&nbsp;error&nbsp;to&nbsp;socket.&nbsp;Error&nbsp;code&nbsp;was&nbsp;["&nbsp;+&nbsp;errorCode&nbsp;+&nbsp;"]");
<a name="line1005"></a><div class="linenumber">1005</div>
<a name="line1006"></a><div class="linenumber">1006</div><div style="width:4em;display:inline-block"></div>next(new&nbsp;pub.util.ConnectionError("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;Unable&nbsp;to&nbsp;return&nbsp;error&nbsp;to&nbsp;socket.&nbsp;Error&nbsp;code&nbsp;was&nbsp;["&nbsp;+&nbsp;errorCode&nbsp;+&nbsp;"]"));
<a name="line1007"></a><div class="linenumber">1007</div><div style="width:4em;display:inline-block"></div>return;
<a name="line1008"></a><div class="linenumber">1008</div><div style="width:2em;display:inline-block"></div>}
<a name="line1009"></a><div class="linenumber">1009</div><div style="width:2em;display:inline-block"></div>if(!_.isFunction(next))&nbsp;{
<a name="line1010"></a><div class="linenumber">1010</div><div style="width:4em;display:inline-block"></div>next&nbsp;=&nbsp;pub.util.nextToNowhere;
<a name="line1011"></a><div class="linenumber">1011</div><div style="width:2em;display:inline-block"></div>}
<a name="line1012"></a><div class="linenumber">1012</div>
<a name="line1013"></a><div class="linenumber">1013</div><div style="width:2em;display:inline-block"></div>var&nbsp;msg&nbsp;=&nbsp;pub.util.getErrorMsg(errorCode);
<a name="line1014"></a><div class="linenumber">1014</div>
<a name="line1015"></a><div class="linenumber">1015</div><div style="width:2em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;msg,&nbsp;appObj);
<a name="line1016"></a><div class="linenumber">1016</div>
<a name="line1017"></a><div class="linenumber">1017</div><div style="width:2em;display:inline-block"></div>next(null);
<a name="line1018"></a><div class="linenumber">1018</div><div style="width:0em;display:inline-block"></div>};
<a name="line1019"></a><div class="linenumber">1019</div>
<a name="line1020"></a><div class="linenumber">1020</div>
<a name="line1021"></a><div class="linenumber">1021</div><div style="width:0em;display:inline-block"></div>/**
<a name="line1022"></a><div class="linenumber">1022</div><div style="width:0em;display:inline-block"></div>*&nbsp;Default&nbsp;listener&nbsp;for&nbsp;event&nbsp;"emitReturnToken".&nbsp;This&nbsp;event&nbsp;is&nbsp;fired&nbsp;when&nbsp;the&nbsp;server&nbsp;should&nbsp;return&nbsp;a&nbsp;token&nbsp;to&nbsp;a&nbsp;client&nbsp;via&nbsp;an&nbsp;acknowledgment&nbsp;message.
<a name="line1023"></a><div class="linenumber">1023</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line1024"></a><div class="linenumber">1024</div><div style="width:0em;display:inline-block"></div>*&nbsp;This&nbsp;is&nbsp;done&nbsp;after&nbsp;a&nbsp;client&nbsp;has&nbsp;been&nbsp;authenticated&nbsp;and&nbsp;the&nbsp;connection&nbsp;has&nbsp;been&nbsp;established.
<a name="line1025"></a><div class="linenumber">1025</div><div style="width:0em;display:inline-block"></div>*
<a name="line1026"></a><div class="linenumber">1026</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;connectionObj&nbsp;&nbsp;EasyRTC&nbsp;connection&nbsp;object.&nbsp;Contains&nbsp;methods&nbsp;used&nbsp;for&nbsp;identifying&nbsp;and&nbsp;managing&nbsp;a&nbsp;connection.
<a name="line1027"></a><div class="linenumber">1027</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Function}&nbsp;socketCallback&nbsp;Socket.io&nbsp;callback&nbsp;function&nbsp;which&nbsp;delivers&nbsp;a&nbsp;response&nbsp;to&nbsp;a&nbsp;socket.&nbsp;Expects&nbsp;a&nbsp;single&nbsp;parameter&nbsp;(msg).
<a name="line1028"></a><div class="linenumber">1028</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line1029"></a><div class="linenumber">1029</div><div style="width:0em;display:inline-block"></div>*/
<a name="line1030"></a><div class="linenumber">1030</div><div style="width:0em;display:inline-block"></div>eventListener.onEmitReturnToken&nbsp;=&nbsp;function(connectionObj,&nbsp;socketCallback,&nbsp;next){
<a name="line1031"></a><div class="linenumber">1031</div><div style="width:2em;display:inline-block"></div>var&nbsp;easyrtcid&nbsp;=&nbsp;connectionObj.getEasyrtcid();
<a name="line1032"></a><div class="linenumber">1032</div><div style="width:2em;display:inline-block"></div>var&nbsp;appObj&nbsp;=&nbsp;connectionObj.getApp();
<a name="line1033"></a><div class="linenumber">1033</div>
<a name="line1034"></a><div class="linenumber">1034</div><div style="width:2em;display:inline-block"></div>pub.util.logDebug("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;Running&nbsp;func&nbsp;'onSendToken'");
<a name="line1035"></a><div class="linenumber">1035</div>
<a name="line1036"></a><div class="linenumber">1036</div><div style="width:2em;display:inline-block"></div>var&nbsp;tokenMsg&nbsp;=&nbsp;{
<a name="line1037"></a><div class="linenumber">1037</div><div style="width:4em;display:inline-block"></div>msgType:&nbsp;"token",
<a name="line1038"></a><div class="linenumber">1038</div><div style="width:4em;display:inline-block"></div>msgData:{}
<a name="line1039"></a><div class="linenumber">1039</div><div style="width:2em;display:inline-block"></div>};
<a name="line1040"></a><div class="linenumber">1040</div>
<a name="line1041"></a><div class="linenumber">1041</div><div style="width:2em;display:inline-block"></div>//&nbsp;Ensure&nbsp;socketCallback&nbsp;is&nbsp;present
<a name="line1042"></a><div class="linenumber">1042</div><div style="width:2em;display:inline-block"></div>if(!_.isFunction(socketCallback))&nbsp;{
<a name="line1043"></a><div class="linenumber">1043</div><div style="width:4em;display:inline-block"></div>pub.util.logWarning("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;EasyRTC&nbsp;onSendToken&nbsp;called&nbsp;with&nbsp;no&nbsp;socketCallback.");
<a name="line1044"></a><div class="linenumber">1044</div><div style="width:4em;display:inline-block"></div>try{connectionObj.socket.disconnect();}catch(e){}
<a name="line1045"></a><div class="linenumber">1045</div><div style="width:4em;display:inline-block"></div>return;
<a name="line1046"></a><div class="linenumber">1046</div><div style="width:2em;display:inline-block"></div>}
<a name="line1047"></a><div class="linenumber">1047</div>
<a name="line1048"></a><div class="linenumber">1048</div><div style="width:2em;display:inline-block"></div>async.waterfall([
<a name="line1049"></a><div class="linenumber">1049</div><div style="width:4em;display:inline-block"></div>function(asyncCallback){
<a name="line1050"></a><div class="linenumber">1050</div><div style="width:6em;display:inline-block"></div>//&nbsp;Get&nbsp;rooms&nbsp;user&nbsp;is&nbsp;in&nbsp;along&nbsp;with&nbsp;list
<a name="line1051"></a><div class="linenumber">1051</div><div style="width:6em;display:inline-block"></div>connectionObj.generateRoomClientList("join",&nbsp;null,&nbsp;asyncCallback);
<a name="line1052"></a><div class="linenumber">1052</div><div style="width:4em;display:inline-block"></div>},
<a name="line1053"></a><div class="linenumber">1053</div><div style="width:4em;display:inline-block"></div>function(roomData,&nbsp;asyncCallback)&nbsp;{
<a name="line1054"></a><div class="linenumber">1054</div><div style="width:6em;display:inline-block"></div>//&nbsp;Set&nbsp;roomData
<a name="line1055"></a><div class="linenumber">1055</div><div style="width:6em;display:inline-block"></div>tokenMsg.msgData.roomData&nbsp;=&nbsp;roomData;
<a name="line1056"></a><div class="linenumber">1056</div>
<a name="line1057"></a><div class="linenumber">1057</div><div style="width:6em;display:inline-block"></div>//&nbsp;Retrieve&nbsp;ice&nbsp;config
<a name="line1058"></a><div class="linenumber">1058</div><div style="width:6em;display:inline-block"></div>connectionObj.events.emit("getIceConfig",&nbsp;connectionObj,&nbsp;asyncCallback);
<a name="line1059"></a><div class="linenumber">1059</div><div style="width:4em;display:inline-block"></div>},
<a name="line1060"></a><div class="linenumber">1060</div>
<a name="line1061"></a><div class="linenumber">1061</div><div style="width:4em;display:inline-block"></div>function(iceServers,&nbsp;asyncCallback)&nbsp;{
<a name="line1062"></a><div class="linenumber">1062</div><div style="width:6em;display:inline-block"></div>tokenMsg.msgData.application&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;{applicationName:connectionObj.getAppName()};
<a name="line1063"></a><div class="linenumber">1063</div><div style="width:6em;display:inline-block"></div>tokenMsg.msgData.easyrtcid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;connectionObj.getEasyrtcid();
<a name="line1064"></a><div class="linenumber">1064</div><div style="width:6em;display:inline-block"></div>tokenMsg.msgData.iceConfig&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;{iceServers:&nbsp;iceServers};
<a name="line1065"></a><div class="linenumber">1065</div><div style="width:6em;display:inline-block"></div>tokenMsg.msgData.serverTime&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;Date.now();
<a name="line1066"></a><div class="linenumber">1066</div>
<a name="line1067"></a><div class="linenumber">1067</div><div style="width:6em;display:inline-block"></div>easyrtcid&nbsp;=&nbsp;tokenMsg.msgData.easyrtcid;
<a name="line1068"></a><div class="linenumber">1068</div>
<a name="line1069"></a><div class="linenumber">1069</div><div style="width:6em;display:inline-block"></div>//&nbsp;Get&nbsp;Application&nbsp;fields
<a name="line1070"></a><div class="linenumber">1070</div><div style="width:6em;display:inline-block"></div>appObj.getFields(true,&nbsp;asyncCallback);
<a name="line1071"></a><div class="linenumber">1071</div><div style="width:4em;display:inline-block"></div>},
<a name="line1072"></a><div class="linenumber">1072</div>
<a name="line1073"></a><div class="linenumber">1073</div><div style="width:4em;display:inline-block"></div>function(fieldObj,&nbsp;asyncCallback)&nbsp;{
<a name="line1074"></a><div class="linenumber">1074</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!_.isEmpty(fieldObj)){
<a name="line1075"></a><div class="linenumber">1075</div><div style="width:8em;display:inline-block"></div>tokenMsg.msgData.application.field&nbsp;=&nbsp;fieldObj;
<a name="line1076"></a><div class="linenumber">1076</div><div style="width:6em;display:inline-block"></div>}
<a name="line1077"></a><div class="linenumber">1077</div>
<a name="line1078"></a><div class="linenumber">1078</div><div style="width:6em;display:inline-block"></div>//&nbsp;Get&nbsp;Connection&nbsp;fields
<a name="line1079"></a><div class="linenumber">1079</div><div style="width:6em;display:inline-block"></div>connectionObj.getFields(true,&nbsp;asyncCallback);
<a name="line1080"></a><div class="linenumber">1080</div><div style="width:4em;display:inline-block"></div>},
<a name="line1081"></a><div class="linenumber">1081</div>
<a name="line1082"></a><div class="linenumber">1082</div><div style="width:4em;display:inline-block"></div>function(fieldObj,&nbsp;asyncCallback)&nbsp;{
<a name="line1083"></a><div class="linenumber">1083</div><div style="width:6em;display:inline-block"></div>if&nbsp;(!_.isEmpty(fieldObj)){
<a name="line1084"></a><div class="linenumber">1084</div><div style="width:8em;display:inline-block"></div>tokenMsg.msgData.field&nbsp;=&nbsp;fieldObj;
<a name="line1085"></a><div class="linenumber">1085</div><div style="width:6em;display:inline-block"></div>}
<a name="line1086"></a><div class="linenumber">1086</div>
<a name="line1087"></a><div class="linenumber">1087</div><div style="width:6em;display:inline-block"></div>//&nbsp;get&nbsp;session&nbsp;object
<a name="line1088"></a><div class="linenumber">1088</div><div style="width:6em;display:inline-block"></div>connectionObj.getSessionObj(asyncCallback);
<a name="line1089"></a><div class="linenumber">1089</div><div style="width:4em;display:inline-block"></div>},
<a name="line1090"></a><div class="linenumber">1090</div>
<a name="line1091"></a><div class="linenumber">1091</div><div style="width:4em;display:inline-block"></div>function(sessionObj,&nbsp;asyncCallback)&nbsp;{
<a name="line1092"></a><div class="linenumber">1092</div><div style="width:6em;display:inline-block"></div>if&nbsp;(sessionObj)&nbsp;{
<a name="line1093"></a><div class="linenumber">1093</div><div style="width:8em;display:inline-block"></div>tokenMsg.msgData.sessionData&nbsp;=&nbsp;{"easyrtcsid":sessionObj.getEasyrtcsid()};
<a name="line1094"></a><div class="linenumber">1094</div>
<a name="line1095"></a><div class="linenumber">1095</div><div style="width:8em;display:inline-block"></div>//&nbsp;Get&nbsp;session&nbsp;fields
<a name="line1096"></a><div class="linenumber">1096</div><div style="width:8em;display:inline-block"></div>sessionObj.getFields(true,&nbsp;asyncCallback);
<a name="line1097"></a><div class="linenumber">1097</div><div style="width:6em;display:inline-block"></div>}
<a name="line1098"></a><div class="linenumber">1098</div><div style="width:6em;display:inline-block"></div>else&nbsp;{
<a name="line1099"></a><div class="linenumber">1099</div><div style="width:8em;display:inline-block"></div>asyncCallback(null,&nbsp;null);
<a name="line1100"></a><div class="linenumber">1100</div><div style="width:6em;display:inline-block"></div>}
<a name="line1101"></a><div class="linenumber">1101</div><div style="width:4em;display:inline-block"></div>},
<a name="line1102"></a><div class="linenumber">1102</div>
<a name="line1103"></a><div class="linenumber">1103</div><div style="width:4em;display:inline-block"></div>function(fieldObj,&nbsp;asyncCallback)&nbsp;{
<a name="line1104"></a><div class="linenumber">1104</div><div style="width:6em;display:inline-block"></div>//&nbsp;Set&nbsp;session&nbsp;field&nbsp;(if&nbsp;present)
<a name="line1105"></a><div class="linenumber">1105</div><div style="width:6em;display:inline-block"></div>if&nbsp;(fieldObj&nbsp;&amp;&amp;&nbsp;!_.isEmpty(fieldObj)){
<a name="line1106"></a><div class="linenumber">1106</div><div style="width:8em;display:inline-block"></div>tokenMsg.msgData.sessionData.field&nbsp;=&nbsp;fieldObj;
<a name="line1107"></a><div class="linenumber">1107</div><div style="width:6em;display:inline-block"></div>}
<a name="line1108"></a><div class="linenumber">1108</div>
<a name="line1109"></a><div class="linenumber">1109</div><div style="width:6em;display:inline-block"></div>//&nbsp;Emit&nbsp;token&nbsp;back&nbsp;to&nbsp;socket&nbsp;(SUCCESS!)
<a name="line1110"></a><div class="linenumber">1110</div><div style="width:6em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;tokenMsg,&nbsp;appObj);
<a name="line1111"></a><div class="linenumber">1111</div>
<a name="line1112"></a><div class="linenumber">1112</div><div style="width:6em;display:inline-block"></div>asyncCallback(null);
<a name="line1113"></a><div class="linenumber">1113</div><div style="width:4em;display:inline-block"></div>}
<a name="line1114"></a><div class="linenumber">1114</div>
<a name="line1115"></a><div class="linenumber">1115</div><div style="width:2em;display:inline-block"></div>],
<a name="line1116"></a><div class="linenumber">1116</div><div style="width:2em;display:inline-block"></div>//&nbsp;This&nbsp;function&nbsp;is&nbsp;called&nbsp;upon&nbsp;completion&nbsp;of&nbsp;the&nbsp;async&nbsp;waterfall,&nbsp;or&nbsp;upon&nbsp;an&nbsp;error&nbsp;being&nbsp;thrown.
<a name="line1117"></a><div class="linenumber">1117</div><div style="width:2em;display:inline-block"></div>function&nbsp;(err)&nbsp;{
<a name="line1118"></a><div class="linenumber">1118</div><div style="width:4em;display:inline-block"></div>if&nbsp;(err){
<a name="line1119"></a><div class="linenumber">1119</div><div style="width:6em;display:inline-block"></div>next(err);
<a name="line1120"></a><div class="linenumber">1120</div><div style="width:4em;display:inline-block"></div>}&nbsp;else&nbsp;{
<a name="line1121"></a><div class="linenumber">1121</div><div style="width:6em;display:inline-block"></div>next(null);
<a name="line1122"></a><div class="linenumber">1122</div><div style="width:4em;display:inline-block"></div>}
<a name="line1123"></a><div class="linenumber">1123</div><div style="width:2em;display:inline-block"></div>});
<a name="line1124"></a><div class="linenumber">1124</div><div style="width:0em;display:inline-block"></div>};
<a name="line1125"></a><div class="linenumber">1125</div>
<a name="line1126"></a><div class="linenumber">1126</div>
<a name="line1127"></a><div class="linenumber">1127</div><div style="width:0em;display:inline-block"></div>/**
<a name="line1128"></a><div class="linenumber">1128</div><div style="width:0em;display:inline-block"></div>*&nbsp;Default&nbsp;listener&nbsp;for&nbsp;event&nbsp;"log".&nbsp;This&nbsp;event&nbsp;is&nbsp;fired&nbsp;when&nbsp;ever&nbsp;a&nbsp;loggable&nbsp;item&nbsp;is&nbsp;observed.
<a name="line1129"></a><div class="linenumber">1129</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line1130"></a><div class="linenumber">1130</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;level&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Log&nbsp;severity&nbsp;level.&nbsp;Can&nbsp;be&nbsp;("debug"|"info"|"warning"|"error")
<a name="line1131"></a><div class="linenumber">1131</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;logText&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Text&nbsp;for&nbsp;log.
<a name="line1132"></a><div class="linenumber">1132</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?*}&nbsp;[logFields]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Simple&nbsp;JSON&nbsp;object&nbsp;which&nbsp;contains&nbsp;extra&nbsp;fields&nbsp;to&nbsp;be&nbsp;logged.
<a name="line1133"></a><div class="linenumber">1133</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?nextCallback}&nbsp;next&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line1134"></a><div class="linenumber">1134</div><div style="width:0em;display:inline-block"></div>*/
<a name="line1135"></a><div class="linenumber">1135</div><div style="width:0em;display:inline-block"></div>eventListener.onLog&nbsp;=&nbsp;function(level,&nbsp;logText,&nbsp;logFields,&nbsp;next)&nbsp;{
<a name="line1136"></a><div class="linenumber">1136</div><div style="width:2em;display:inline-block"></div>if(!_.isFunction(next))&nbsp;{
<a name="line1137"></a><div class="linenumber">1137</div><div style="width:4em;display:inline-block"></div>next&nbsp;=&nbsp;pub.util.nextToNowhere;
<a name="line1138"></a><div class="linenumber">1138</div><div style="width:2em;display:inline-block"></div>}
<a name="line1139"></a><div class="linenumber">1139</div>
<a name="line1140"></a><div class="linenumber">1140</div><div style="width:2em;display:inline-block"></div>var&nbsp;consoleText&nbsp;=&nbsp;"";
<a name="line1141"></a><div class="linenumber">1141</div>
<a name="line1142"></a><div class="linenumber">1142</div><div style="width:2em;display:inline-block"></div>var&nbsp;currentDate&nbsp;=&nbsp;new&nbsp;Date();
<a name="line1143"></a><div class="linenumber">1143</div><div style="width:2em;display:inline-block"></div>if&nbsp;(pub.getOption("logColorEnable"))&nbsp;{
<a name="line1144"></a><div class="linenumber">1144</div><div style="width:4em;display:inline-block"></div>var&nbsp;colors&nbsp;=&nbsp;require("colors");
<a name="line1145"></a><div class="linenumber">1145</div><div style="width:4em;display:inline-block"></div>if(pub.getOption("logDateEnable"))&nbsp;{
<a name="line1146"></a><div class="linenumber">1146</div><div style="width:6em;display:inline-block"></div>consoleText&nbsp;+=&nbsp;currentDate.toISOString().grey&nbsp;+&nbsp;"&nbsp;-&nbsp;";
<a name="line1147"></a><div class="linenumber">1147</div><div style="width:4em;display:inline-block"></div>}
<a name="line1148"></a><div class="linenumber">1148</div><div style="width:4em;display:inline-block"></div>switch&nbsp;(level)&nbsp;{
<a name="line1149"></a><div class="linenumber">1149</div><div style="width:6em;display:inline-block"></div>case&nbsp;"debug":
<a name="line1150"></a><div class="linenumber">1150</div><div style="width:8em;display:inline-block"></div>consoleText&nbsp;+=&nbsp;"debug&nbsp;&nbsp;".bold.blue;
<a name="line1151"></a><div class="linenumber">1151</div><div style="width:8em;display:inline-block"></div>break;
<a name="line1152"></a><div class="linenumber">1152</div><div style="width:6em;display:inline-block"></div>case&nbsp;"info":
<a name="line1153"></a><div class="linenumber">1153</div><div style="width:8em;display:inline-block"></div>consoleText&nbsp;+=&nbsp;"info&nbsp;&nbsp;&nbsp;".bold.green;
<a name="line1154"></a><div class="linenumber">1154</div><div style="width:8em;display:inline-block"></div>break;
<a name="line1155"></a><div class="linenumber">1155</div><div style="width:6em;display:inline-block"></div>case&nbsp;"warning":
<a name="line1156"></a><div class="linenumber">1156</div><div style="width:8em;display:inline-block"></div>consoleText&nbsp;+=&nbsp;"warning".bold.yellow;
<a name="line1157"></a><div class="linenumber">1157</div><div style="width:8em;display:inline-block"></div>break;
<a name="line1158"></a><div class="linenumber">1158</div><div style="width:6em;display:inline-block"></div>case&nbsp;"error":
<a name="line1159"></a><div class="linenumber">1159</div><div style="width:8em;display:inline-block"></div>consoleText&nbsp;+=&nbsp;"error&nbsp;&nbsp;".bold.red;
<a name="line1160"></a><div class="linenumber">1160</div><div style="width:8em;display:inline-block"></div>break;
<a name="line1161"></a><div class="linenumber">1161</div><div style="width:6em;display:inline-block"></div>default:
<a name="line1162"></a><div class="linenumber">1162</div><div style="width:8em;display:inline-block"></div>consoleText&nbsp;+=&nbsp;level.bold;
<a name="line1163"></a><div class="linenumber">1163</div><div style="width:4em;display:inline-block"></div>}
<a name="line1164"></a><div class="linenumber">1164</div><div style="width:4em;display:inline-block"></div>consoleText&nbsp;+=&nbsp;"&nbsp;-&nbsp;"&nbsp;+&nbsp;"EasyRTC:&nbsp;".bold&nbsp;+&nbsp;logText;
<a name="line1165"></a><div class="linenumber">1165</div><div style="width:2em;display:inline-block"></div>}
<a name="line1166"></a><div class="linenumber">1166</div><div style="width:2em;display:inline-block"></div>else&nbsp;{
<a name="line1167"></a><div class="linenumber">1167</div><div style="width:4em;display:inline-block"></div>if(pub.getOption("logDateEnable"))&nbsp;{
<a name="line1168"></a><div class="linenumber">1168</div><div style="width:6em;display:inline-block"></div>consoleText&nbsp;+=&nbsp;currentDate.toISOString()&nbsp;+&nbsp;"&nbsp;-&nbsp;";
<a name="line1169"></a><div class="linenumber">1169</div><div style="width:4em;display:inline-block"></div>}
<a name="line1170"></a><div class="linenumber">1170</div><div style="width:4em;display:inline-block"></div>consoleText&nbsp;+=&nbsp;level;
<a name="line1171"></a><div class="linenumber">1171</div><div style="width:4em;display:inline-block"></div>consoleText&nbsp;+=&nbsp;"&nbsp;-&nbsp;"&nbsp;+&nbsp;"EasyRTC:&nbsp;"&nbsp;+&nbsp;logText;
<a name="line1172"></a><div class="linenumber">1172</div><div style="width:2em;display:inline-block"></div>}
<a name="line1173"></a><div class="linenumber">1173</div>
<a name="line1174"></a><div class="linenumber">1174</div><div style="width:2em;display:inline-block"></div>if&nbsp;(logFields&nbsp;!=&nbsp;undefined&nbsp;&amp;&amp;&nbsp;logFields&nbsp;!=&nbsp;null)&nbsp;{
<a name="line1175"></a><div class="linenumber">1175</div><div style="width:4em;display:inline-block"></div>if&nbsp;(pub.getOption("logErrorStackEnable")&nbsp;&amp;&amp;&nbsp;pub.util.isError(logFields))&nbsp;{
<a name="line1176"></a><div class="linenumber">1176</div><div style="width:6em;display:inline-block"></div>console.log(consoleText,&nbsp;((pub.getOption("logColorEnable"))?&nbsp;"\nStack&nbsp;Trace:\n------------\n".bold&nbsp;+&nbsp;logFields.stack.magenta&nbsp;+&nbsp;"\n------------".bold&nbsp;:&nbsp;"\nStack&nbsp;Trace:\n------------\n"&nbsp;+&nbsp;logFields.stack&nbsp;+&nbsp;"\n------------"));
<a name="line1177"></a><div class="linenumber">1177</div><div style="width:4em;display:inline-block"></div>}
<a name="line1178"></a><div class="linenumber">1178</div><div style="width:4em;display:inline-block"></div>else&nbsp;if&nbsp;(pub.getOption("logWarningStackEnable")&nbsp;&amp;&amp;&nbsp;pub.util.isWarning(logFields))&nbsp;{
<a name="line1179"></a><div class="linenumber">1179</div><div style="width:6em;display:inline-block"></div>console.log(consoleText,&nbsp;((pub.getOption("logColorEnable"))?&nbsp;"\nStack&nbsp;Trace:\n------------\n".bold&nbsp;+&nbsp;logFields.stack.cyan&nbsp;+&nbsp;"\n------------".bold&nbsp;:&nbsp;"\nStack&nbsp;Trace:\n------------\n"&nbsp;+&nbsp;logFields.stack&nbsp;+&nbsp;"\n------------"));
<a name="line1180"></a><div class="linenumber">1180</div><div style="width:4em;display:inline-block"></div>}
<a name="line1181"></a><div class="linenumber">1181</div><div style="width:4em;display:inline-block"></div>else&nbsp;{
<a name="line1182"></a><div class="linenumber">1182</div><div style="width:6em;display:inline-block"></div>console.log(consoleText,&nbsp;util.inspect(logFields,&nbsp;{colors:pub.getOption("logColorEnable"),&nbsp;showHidden:false,&nbsp;depth:pub.getOption("logObjectDepth")}));
<a name="line1183"></a><div class="linenumber">1183</div><div style="width:4em;display:inline-block"></div>}
<a name="line1184"></a><div class="linenumber">1184</div><div style="width:2em;display:inline-block"></div>}&nbsp;else&nbsp;{
<a name="line1185"></a><div class="linenumber">1185</div><div style="width:4em;display:inline-block"></div>console.log(consoleText);
<a name="line1186"></a><div class="linenumber">1186</div><div style="width:2em;display:inline-block"></div>}
<a name="line1187"></a><div class="linenumber">1187</div><div style="width:2em;display:inline-block"></div>next(null);
<a name="line1188"></a><div class="linenumber">1188</div><div style="width:0em;display:inline-block"></div>};
<a name="line1189"></a><div class="linenumber">1189</div>
<a name="line1190"></a><div class="linenumber">1190</div>
<a name="line1191"></a><div class="linenumber">1191</div><div style="width:0em;display:inline-block"></div>/**
<a name="line1192"></a><div class="linenumber">1192</div><div style="width:0em;display:inline-block"></div>*&nbsp;Default&nbsp;listener&nbsp;for&nbsp;event&nbsp;"msgTypeRoomJoin".&nbsp;This&nbsp;event&nbsp;is&nbsp;fired&nbsp;when&nbsp;an&nbsp;easyrtcCmd&nbsp;message&nbsp;with&nbsp;msgType&nbsp;of&nbsp;"roomJoin"&nbsp;is&nbsp;received&nbsp;from&nbsp;a&nbsp;client.&nbsp;
<a name="line1193"></a><div class="linenumber">1193</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line1194"></a><div class="linenumber">1194</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;connectionObj&nbsp;&nbsp;EasyRTC&nbsp;connection&nbsp;object.&nbsp;Contains&nbsp;methods&nbsp;used&nbsp;for&nbsp;identifying&nbsp;and&nbsp;managing&nbsp;a&nbsp;connection.
<a name="line1195"></a><div class="linenumber">1195</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;rooms&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;room&nbsp;object&nbsp;containing&nbsp;a&nbsp;map&nbsp;of&nbsp;room&nbsp;names&nbsp;and&nbsp;room&nbsp;parameters.
<a name="line1196"></a><div class="linenumber">1196</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Function}&nbsp;socketCallback&nbsp;Socket.io&nbsp;callback&nbsp;function&nbsp;which&nbsp;delivers&nbsp;a&nbsp;response&nbsp;to&nbsp;a&nbsp;socket.&nbsp;Expects&nbsp;a&nbsp;single&nbsp;parameter&nbsp;(msg).
<a name="line1197"></a><div class="linenumber">1197</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line1198"></a><div class="linenumber">1198</div><div style="width:0em;display:inline-block"></div>*/
<a name="line1199"></a><div class="linenumber">1199</div><div style="width:0em;display:inline-block"></div>eventListener.onMsgTypeRoomJoin&nbsp;=&nbsp;function(connectionObj,&nbsp;rooms,&nbsp;socketCallback,&nbsp;next){
<a name="line1200"></a><div class="linenumber">1200</div><div style="width:2em;display:inline-block"></div>var&nbsp;easyrtcid&nbsp;=&nbsp;connectionObj.getEasyrtcid();
<a name="line1201"></a><div class="linenumber">1201</div><div style="width:2em;display:inline-block"></div>var&nbsp;appObj&nbsp;=&nbsp;connectionObj.getApp();
<a name="line1202"></a><div class="linenumber">1202</div>
<a name="line1203"></a><div class="linenumber">1203</div><div style="width:2em;display:inline-block"></div>pub.util.logDebug("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;Running&nbsp;func&nbsp;'onMsgTypeRoomJoin'");
<a name="line1204"></a><div class="linenumber">1204</div><div style="width:2em;display:inline-block"></div>if(!_.isFunction(socketCallback))&nbsp;{
<a name="line1205"></a><div class="linenumber">1205</div><div style="width:4em;display:inline-block"></div>pub.util.logWarning("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;EasyRTC&nbsp;info:&nbsp;unhandled&nbsp;socket&nbsp;message&nbsp;callback.");
<a name="line1206"></a><div class="linenumber">1206</div><div style="width:4em;display:inline-block"></div>return;
<a name="line1207"></a><div class="linenumber">1207</div><div style="width:2em;display:inline-block"></div>}
<a name="line1208"></a><div class="linenumber">1208</div>
<a name="line1209"></a><div class="linenumber">1209</div><div style="width:2em;display:inline-block"></div>if(!_.isFunction(next))&nbsp;{
<a name="line1210"></a><div class="linenumber">1210</div><div style="width:4em;display:inline-block"></div>next&nbsp;=&nbsp;pub.util.nextToNowhere;
<a name="line1211"></a><div class="linenumber">1211</div><div style="width:2em;display:inline-block"></div>}
<a name="line1212"></a><div class="linenumber">1212</div>
<a name="line1213"></a><div class="linenumber">1213</div><div style="width:2em;display:inline-block"></div>if(!_.isObject(rooms)&nbsp;||&nbsp;_.isEmpty(rooms))&nbsp;{
<a name="line1214"></a><div class="linenumber">1214</div><div style="width:4em;display:inline-block"></div>pub.events.emit("emitReturnError",&nbsp;socketCallback,&nbsp;"MSG_REJECT_BAD_STRUCTURE",&nbsp;pub.util.nextToNowhere);
<a name="line1215"></a><div class="linenumber">1215</div><div style="width:4em;display:inline-block"></div>return;
<a name="line1216"></a><div class="linenumber">1216</div><div style="width:2em;display:inline-block"></div>}
<a name="line1217"></a><div class="linenumber">1217</div>
<a name="line1218"></a><div class="linenumber">1218</div><div style="width:2em;display:inline-block"></div>for&nbsp;(var&nbsp;currentRoomName&nbsp;in&nbsp;rooms)&nbsp;{
<a name="line1219"></a><div class="linenumber">1219</div><div style="width:4em;display:inline-block"></div>if&nbsp;(!_.isString(currentRoomName)&nbsp;||&nbsp;!connectionObj.getApp().getOption("roomNameRegExp").test(currentRoomName))&nbsp;{
<a name="line1220"></a><div class="linenumber">1220</div><div style="width:6em;display:inline-block"></div>pub.events.emit("emitReturnError",&nbsp;socketCallback,&nbsp;"MSG_REJECT_TARGET_ROOM",&nbsp;pub.util.nextToNowhere);
<a name="line1221"></a><div class="linenumber">1221</div><div style="width:6em;display:inline-block"></div>return;
<a name="line1222"></a><div class="linenumber">1222</div><div style="width:4em;display:inline-block"></div>}
<a name="line1223"></a><div class="linenumber">1223</div><div style="width:2em;display:inline-block"></div>}
<a name="line1224"></a><div class="linenumber">1224</div>
<a name="line1225"></a><div class="linenumber">1225</div><div style="width:2em;display:inline-block"></div>async.each(Object.keys(rooms),&nbsp;function(currentRoomName,&nbsp;roomCallback)&nbsp;{
<a name="line1226"></a><div class="linenumber">1226</div><div style="width:4em;display:inline-block"></div>appObj.isRoom(currentRoomName,&nbsp;function(err,&nbsp;isRoom){
<a name="line1227"></a><div class="linenumber">1227</div>
<a name="line1228"></a><div class="linenumber">1228</div><div style="width:6em;display:inline-block"></div>//&nbsp;Set&nbsp;roomParameter&nbsp;map.&nbsp;This&nbsp;may&nbsp;be&nbsp;used&nbsp;by&nbsp;custom&nbsp;listeners.
<a name="line1229"></a><div class="linenumber">1229</div><div style="width:6em;display:inline-block"></div>var&nbsp;currentRoomParameter;
<a name="line1230"></a><div class="linenumber">1230</div><div style="width:6em;display:inline-block"></div>if&nbsp;(rooms[currentRoomName]&nbsp;&amp;&amp;&nbsp;_.isObject(rooms[currentRoomName].roomParameter)){
<a name="line1231"></a><div class="linenumber">1231</div><div style="width:8em;display:inline-block"></div>currentRoomParameter&nbsp;=&nbsp;rooms[currentRoomName].roomParameter;
<a name="line1232"></a><div class="linenumber">1232</div><div style="width:6em;display:inline-block"></div>}
<a name="line1233"></a><div class="linenumber">1233</div>
<a name="line1234"></a><div class="linenumber">1234</div><div style="width:6em;display:inline-block"></div>if&nbsp;(isRoom)&nbsp;{
<a name="line1235"></a><div class="linenumber">1235</div><div style="width:8em;display:inline-block"></div>pub.events.emit("roomJoin",&nbsp;connectionObj,&nbsp;currentRoomName,&nbsp;currentRoomParameter,&nbsp;roomCallback);
<a name="line1236"></a><div class="linenumber">1236</div><div style="width:6em;display:inline-block"></div>}
<a name="line1237"></a><div class="linenumber">1237</div><div style="width:6em;display:inline-block"></div>else&nbsp;if&nbsp;(appObj.getOption("roomAutoCreateEnable"))&nbsp;{
<a name="line1238"></a><div class="linenumber">1238</div><div style="width:8em;display:inline-block"></div>pub.events.emit("roomCreate",&nbsp;appObj,&nbsp;connectionObj,&nbsp;currentRoomName,&nbsp;null,&nbsp;function(err,&nbsp;roomObj){
<a name="line1239"></a><div class="linenumber">1239</div><div style="width:10em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line1240"></a><div class="linenumber">1240</div><div style="width:12em;display:inline-block"></div>roomCallback(err);
<a name="line1241"></a><div class="linenumber">1241</div><div style="width:12em;display:inline-block"></div>return;
<a name="line1242"></a><div class="linenumber">1242</div><div style="width:10em;display:inline-block"></div>}
<a name="line1243"></a><div class="linenumber">1243</div><div style="width:10em;display:inline-block"></div>pub.events.emit("roomJoin",&nbsp;connectionObj,&nbsp;currentRoomName,&nbsp;currentRoomParameter,&nbsp;roomCallback);
<a name="line1244"></a><div class="linenumber">1244</div><div style="width:8em;display:inline-block"></div>});
<a name="line1245"></a><div class="linenumber">1245</div><div style="width:6em;display:inline-block"></div>}
<a name="line1246"></a><div class="linenumber">1246</div><div style="width:6em;display:inline-block"></div>else&nbsp;{
<a name="line1247"></a><div class="linenumber">1247</div><div style="width:8em;display:inline-block"></div>pub.util.logWarning("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]["+currentRoomName+"]&nbsp;Unable&nbsp;to&nbsp;join&nbsp;non-existent&nbsp;room.");
<a name="line1248"></a><div class="linenumber">1248</div><div style="width:8em;display:inline-block"></div>roomCallback(new&nbsp;pub.util.ConnectionError("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]["+currentRoomName+"]&nbsp;Unable&nbsp;to&nbsp;join&nbsp;room."));
<a name="line1249"></a><div class="linenumber">1249</div><div style="width:6em;display:inline-block"></div>}
<a name="line1250"></a><div class="linenumber">1250</div><div style="width:4em;display:inline-block"></div>});
<a name="line1251"></a><div class="linenumber">1251</div><div style="width:2em;display:inline-block"></div>},&nbsp;function(err,&nbsp;newRoomObj)&nbsp;{
<a name="line1252"></a><div class="linenumber">1252</div><div style="width:4em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line1253"></a><div class="linenumber">1253</div><div style="width:6em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;pub.util.getErrorMsg("MSG_REJECT_BAD_ROOM"),&nbsp;appObj);
<a name="line1254"></a><div class="linenumber">1254</div><div style="width:6em;display:inline-block"></div>next(null);&nbsp;//&nbsp;Error&nbsp;has&nbsp;been&nbsp;handled
<a name="line1255"></a><div class="linenumber">1255</div><div style="width:6em;display:inline-block"></div>return;
<a name="line1256"></a><div class="linenumber">1256</div><div style="width:4em;display:inline-block"></div>}
<a name="line1257"></a><div class="linenumber">1257</div>
<a name="line1258"></a><div class="linenumber">1258</div><div style="width:4em;display:inline-block"></div>connectionObj.generateRoomClientList("join",&nbsp;rooms,&nbsp;function(err,&nbsp;roomData){
<a name="line1259"></a><div class="linenumber">1259</div><div style="width:6em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line1260"></a><div class="linenumber">1260</div><div style="width:8em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;pub.util.getErrorMsg("MSG_REJECT_BAD_ROOM"),&nbsp;appObj);
<a name="line1261"></a><div class="linenumber">1261</div><div style="width:8em;display:inline-block"></div>next(null);&nbsp;//&nbsp;Error&nbsp;has&nbsp;been&nbsp;handled
<a name="line1262"></a><div class="linenumber">1262</div><div style="width:6em;display:inline-block"></div>}
<a name="line1263"></a><div class="linenumber">1263</div><div style="width:6em;display:inline-block"></div>else&nbsp;{
<a name="line1264"></a><div class="linenumber">1264</div><div style="width:8em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;{"msgType":"roomData",&nbsp;"msgData":{"roomData":roomData}},&nbsp;appObj);
<a name="line1265"></a><div class="linenumber">1265</div><div style="width:6em;display:inline-block"></div>}
<a name="line1266"></a><div class="linenumber">1266</div><div style="width:4em;display:inline-block"></div>});
<a name="line1267"></a><div class="linenumber">1267</div><div style="width:2em;display:inline-block"></div>});
<a name="line1268"></a><div class="linenumber">1268</div><div style="width:0em;display:inline-block"></div>};
<a name="line1269"></a><div class="linenumber">1269</div>
<a name="line1270"></a><div class="linenumber">1270</div>
<a name="line1271"></a><div class="linenumber">1271</div><div style="width:0em;display:inline-block"></div>/**
<a name="line1272"></a><div class="linenumber">1272</div><div style="width:0em;display:inline-block"></div>*&nbsp;Default&nbsp;listener&nbsp;for&nbsp;event&nbsp;"msgTypeRoomLeave".&nbsp;This&nbsp;event&nbsp;is&nbsp;fired&nbsp;when&nbsp;an&nbsp;easyrtcCmd&nbsp;message&nbsp;with&nbsp;msgType&nbsp;of&nbsp;"roomLeave"&nbsp;is&nbsp;received&nbsp;from&nbsp;a&nbsp;client.&nbsp;
<a name="line1273"></a><div class="linenumber">1273</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line1274"></a><div class="linenumber">1274</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;connectionObj&nbsp;&nbsp;EasyRTC&nbsp;connection&nbsp;object.&nbsp;Contains&nbsp;methods&nbsp;used&nbsp;for&nbsp;identifying&nbsp;and&nbsp;managing&nbsp;a&nbsp;connection.
<a name="line1275"></a><div class="linenumber">1275</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;rooms&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;room&nbsp;object&nbsp;containing&nbsp;a&nbsp;map&nbsp;of&nbsp;room&nbsp;names.
<a name="line1276"></a><div class="linenumber">1276</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Function}&nbsp;socketCallback&nbsp;Socket.io&nbsp;callback&nbsp;function&nbsp;which&nbsp;delivers&nbsp;a&nbsp;response&nbsp;to&nbsp;a&nbsp;socket.&nbsp;Expects&nbsp;a&nbsp;single&nbsp;parameter&nbsp;(msg).
<a name="line1277"></a><div class="linenumber">1277</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line1278"></a><div class="linenumber">1278</div><div style="width:0em;display:inline-block"></div>*/
<a name="line1279"></a><div class="linenumber">1279</div><div style="width:0em;display:inline-block"></div>eventListener.onMsgTypeRoomLeave&nbsp;=&nbsp;function(connectionObj,&nbsp;rooms,&nbsp;socketCallback,&nbsp;next){
<a name="line1280"></a><div class="linenumber">1280</div><div style="width:2em;display:inline-block"></div>var&nbsp;easyrtcid&nbsp;=&nbsp;connectionObj.getEasyrtcid();
<a name="line1281"></a><div class="linenumber">1281</div><div style="width:2em;display:inline-block"></div>var&nbsp;appObj&nbsp;=&nbsp;connectionObj.getApp();
<a name="line1282"></a><div class="linenumber">1282</div>
<a name="line1283"></a><div class="linenumber">1283</div><div style="width:2em;display:inline-block"></div>pub.util.logDebug("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;Running&nbsp;func&nbsp;'onMsgTypeRoomLeave'&nbsp;with&nbsp;rooms:&nbsp;",rooms);
<a name="line1284"></a><div class="linenumber">1284</div><div style="width:2em;display:inline-block"></div>if(!_.isFunction(socketCallback))&nbsp;{
<a name="line1285"></a><div class="linenumber">1285</div><div style="width:4em;display:inline-block"></div>socketCallback&nbsp;=&nbsp;function(returnMsg)&nbsp;{
<a name="line1286"></a><div class="linenumber">1286</div><div style="width:6em;display:inline-block"></div>pub.util.logDebug("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;EasyRTC&nbsp;info:&nbsp;unhandled&nbsp;ACK&nbsp;return&nbsp;message.",&nbsp;returnMsg);
<a name="line1287"></a><div class="linenumber">1287</div><div style="width:4em;display:inline-block"></div>};
<a name="line1288"></a><div class="linenumber">1288</div><div style="width:2em;display:inline-block"></div>}
<a name="line1289"></a><div class="linenumber">1289</div>
<a name="line1290"></a><div class="linenumber">1290</div><div style="width:2em;display:inline-block"></div>if(!_.isFunction(next))&nbsp;{
<a name="line1291"></a><div class="linenumber">1291</div><div style="width:4em;display:inline-block"></div>next&nbsp;=&nbsp;pub.util.nextToNowhere;
<a name="line1292"></a><div class="linenumber">1292</div><div style="width:2em;display:inline-block"></div>}
<a name="line1293"></a><div class="linenumber">1293</div>
<a name="line1294"></a><div class="linenumber">1294</div><div style="width:2em;display:inline-block"></div>//&nbsp;Loop&nbsp;through&nbsp;each&nbsp;room&nbsp;in&nbsp;the&nbsp;rooms&nbsp;object.&nbsp;Emit&nbsp;the&nbsp;leaveRoom&nbsp;event&nbsp;for&nbsp;each&nbsp;one.
<a name="line1295"></a><div class="linenumber">1295</div><div style="width:2em;display:inline-block"></div>async.each(Object.keys(rooms),&nbsp;function(currentRoomName,&nbsp;asyncCallback)&nbsp;{
<a name="line1296"></a><div class="linenumber">1296</div><div style="width:4em;display:inline-block"></div>connectionObj.events.emit("roomLeave",&nbsp;connectionObj,&nbsp;currentRoomName,&nbsp;function(err){
<a name="line1297"></a><div class="linenumber">1297</div><div style="width:6em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line1298"></a><div class="linenumber">1298</div><div style="width:8em;display:inline-block"></div>pub.util.logWarning("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;Error&nbsp;leaving&nbsp;room&nbsp;["+currentRoomName+"].",&nbsp;err);
<a name="line1299"></a><div class="linenumber">1299</div><div style="width:6em;display:inline-block"></div>}
<a name="line1300"></a><div class="linenumber">1300</div><div style="width:6em;display:inline-block"></div>asyncCallback(null);
<a name="line1301"></a><div class="linenumber">1301</div><div style="width:4em;display:inline-block"></div>});
<a name="line1302"></a><div class="linenumber">1302</div><div style="width:2em;display:inline-block"></div>},&nbsp;function(err,&nbsp;newRoomObj)&nbsp;{
<a name="line1303"></a><div class="linenumber">1303</div><div style="width:4em;display:inline-block"></div>var&nbsp;roomData&nbsp;=&nbsp;{};
<a name="line1304"></a><div class="linenumber">1304</div><div style="width:4em;display:inline-block"></div>for&nbsp;(var&nbsp;currentRoomName&nbsp;in&nbsp;rooms)&nbsp;{
<a name="line1305"></a><div class="linenumber">1305</div><div style="width:6em;display:inline-block"></div>roomData[currentRoomName]={
<a name="line1306"></a><div class="linenumber">1306</div><div style="width:8em;display:inline-block"></div>"roomName":&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;currentRoomName,
<a name="line1307"></a><div class="linenumber">1307</div><div style="width:8em;display:inline-block"></div>"roomStatus":&nbsp;&nbsp;&nbsp;"leave"
<a name="line1308"></a><div class="linenumber">1308</div><div style="width:6em;display:inline-block"></div>};
<a name="line1309"></a><div class="linenumber">1309</div><div style="width:4em;display:inline-block"></div>}
<a name="line1310"></a><div class="linenumber">1310</div><div style="width:4em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;{"msgType":"roomData",&nbsp;"msgData":{"roomData":roomData}},&nbsp;appObj);
<a name="line1311"></a><div class="linenumber">1311</div><div style="width:4em;display:inline-block"></div>next(null);
<a name="line1312"></a><div class="linenumber">1312</div><div style="width:2em;display:inline-block"></div>});
<a name="line1313"></a><div class="linenumber">1313</div><div style="width:0em;display:inline-block"></div>};
<a name="line1314"></a><div class="linenumber">1314</div>
<a name="line1315"></a><div class="linenumber">1315</div>
<a name="line1316"></a><div class="linenumber">1316</div><div style="width:0em;display:inline-block"></div>/**
<a name="line1317"></a><div class="linenumber">1317</div><div style="width:0em;display:inline-block"></div>*&nbsp;Default&nbsp;listener&nbsp;for&nbsp;event&nbsp;"msgTypeGetIceConfig".&nbsp;This&nbsp;event&nbsp;is&nbsp;fired&nbsp;when&nbsp;an&nbsp;easyrtcCmd&nbsp;message&nbsp;with&nbsp;msgType&nbsp;of&nbsp;"getIceConfig"&nbsp;is&nbsp;received&nbsp;from&nbsp;a&nbsp;client.&nbsp;
<a name="line1318"></a><div class="linenumber">1318</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line1319"></a><div class="linenumber">1319</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;connectionObj&nbsp;&nbsp;EasyRTC&nbsp;connection&nbsp;object.&nbsp;Contains&nbsp;methods&nbsp;used&nbsp;for&nbsp;identifying&nbsp;and&nbsp;managing&nbsp;a&nbsp;connection.
<a name="line1320"></a><div class="linenumber">1320</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Function}&nbsp;socketCallback&nbsp;Socket.io&nbsp;callback&nbsp;function&nbsp;which&nbsp;delivers&nbsp;a&nbsp;response&nbsp;to&nbsp;a&nbsp;socket.&nbsp;Expects&nbsp;a&nbsp;single&nbsp;parameter&nbsp;(msg).
<a name="line1321"></a><div class="linenumber">1321</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line1322"></a><div class="linenumber">1322</div><div style="width:0em;display:inline-block"></div>*/
<a name="line1323"></a><div class="linenumber">1323</div><div style="width:0em;display:inline-block"></div>eventListener.onMsgTypeGetIceConfig&nbsp;=&nbsp;function(connectionObj,&nbsp;socketCallback,&nbsp;next){
<a name="line1324"></a><div class="linenumber">1324</div><div style="width:2em;display:inline-block"></div>var&nbsp;easyrtcid&nbsp;=&nbsp;connectionObj.getEasyrtcid();
<a name="line1325"></a><div class="linenumber">1325</div><div style="width:2em;display:inline-block"></div>var&nbsp;appObj&nbsp;=&nbsp;connectionObj.getApp();
<a name="line1326"></a><div class="linenumber">1326</div>
<a name="line1327"></a><div class="linenumber">1327</div><div style="width:2em;display:inline-block"></div>pub.util.logDebug("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;Running&nbsp;func&nbsp;'onMsgTypeGetIceConfig'");
<a name="line1328"></a><div class="linenumber">1328</div>
<a name="line1329"></a><div class="linenumber">1329</div><div style="width:2em;display:inline-block"></div>if(!_.isFunction(socketCallback))&nbsp;{
<a name="line1330"></a><div class="linenumber">1330</div><div style="width:4em;display:inline-block"></div>socketCallback&nbsp;=&nbsp;function(returnMsg)&nbsp;{
<a name="line1331"></a><div class="linenumber">1331</div><div style="width:6em;display:inline-block"></div>pub.util.logDebug("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;EasyRTC&nbsp;info:&nbsp;unhandled&nbsp;ACK&nbsp;return&nbsp;message.",&nbsp;returnMsg);
<a name="line1332"></a><div class="linenumber">1332</div><div style="width:4em;display:inline-block"></div>};
<a name="line1333"></a><div class="linenumber">1333</div><div style="width:2em;display:inline-block"></div>}
<a name="line1334"></a><div class="linenumber">1334</div>
<a name="line1335"></a><div class="linenumber">1335</div><div style="width:2em;display:inline-block"></div>if(!_.isFunction(next))&nbsp;{
<a name="line1336"></a><div class="linenumber">1336</div><div style="width:4em;display:inline-block"></div>next&nbsp;=&nbsp;pub.util.nextToNowhere;
<a name="line1337"></a><div class="linenumber">1337</div><div style="width:2em;display:inline-block"></div>}
<a name="line1338"></a><div class="linenumber">1338</div>
<a name="line1339"></a><div class="linenumber">1339</div><div style="width:2em;display:inline-block"></div>connectionObj.events.emit("getIceConfig",&nbsp;connectionObj,&nbsp;function(err,&nbsp;iceConfigObj){
<a name="line1340"></a><div class="linenumber">1340</div><div style="width:4em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line1341"></a><div class="linenumber">1341</div><div style="width:6em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;pub.util.getErrorMsg("MSG_REJECT_GEN_FAIL"),&nbsp;appObj);
<a name="line1342"></a><div class="linenumber">1342</div><div style="width:4em;display:inline-block"></div>}
<a name="line1343"></a><div class="linenumber">1343</div><div style="width:4em;display:inline-block"></div>else&nbsp;{
<a name="line1344"></a><div class="linenumber">1344</div><div style="width:6em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;{"msgType":"iceConfig",&nbsp;"msgData":{"iceConfig":{"iceServers":iceConfigObj}}},&nbsp;appObj);
<a name="line1345"></a><div class="linenumber">1345</div><div style="width:4em;display:inline-block"></div>}
<a name="line1346"></a><div class="linenumber">1346</div><div style="width:4em;display:inline-block"></div>next(null);
<a name="line1347"></a><div class="linenumber">1347</div><div style="width:2em;display:inline-block"></div>});
<a name="line1348"></a><div class="linenumber">1348</div><div style="width:0em;display:inline-block"></div>};
<a name="line1349"></a><div class="linenumber">1349</div>
<a name="line1350"></a><div class="linenumber">1350</div>
<a name="line1351"></a><div class="linenumber">1351</div><div style="width:0em;display:inline-block"></div>/**
<a name="line1352"></a><div class="linenumber">1352</div><div style="width:0em;display:inline-block"></div>*&nbsp;Default&nbsp;listener&nbsp;for&nbsp;event&nbsp;"msgTypeGetRoomList".&nbsp;This&nbsp;event&nbsp;is&nbsp;fired&nbsp;when&nbsp;an&nbsp;easyrtcCmd&nbsp;message&nbsp;with&nbsp;msgType&nbsp;of&nbsp;"getRoomList"&nbsp;is&nbsp;received&nbsp;from&nbsp;a&nbsp;client.&nbsp;
<a name="line1353"></a><div class="linenumber">1353</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line1354"></a><div class="linenumber">1354</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;connectionObj&nbsp;&nbsp;EasyRTC&nbsp;connection&nbsp;object.&nbsp;Contains&nbsp;methods&nbsp;used&nbsp;for&nbsp;identifying&nbsp;and&nbsp;managing&nbsp;a&nbsp;connection.
<a name="line1355"></a><div class="linenumber">1355</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Function}&nbsp;socketCallback&nbsp;Socket.io&nbsp;callback&nbsp;function&nbsp;which&nbsp;delivers&nbsp;a&nbsp;response&nbsp;to&nbsp;a&nbsp;socket.&nbsp;Expects&nbsp;a&nbsp;single&nbsp;parameter&nbsp;(msg).
<a name="line1356"></a><div class="linenumber">1356</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line1357"></a><div class="linenumber">1357</div><div style="width:0em;display:inline-block"></div>*/
<a name="line1358"></a><div class="linenumber">1358</div><div style="width:0em;display:inline-block"></div>eventListener.onMsgTypeGetRoomList&nbsp;=&nbsp;function(connectionObj,&nbsp;socketCallback,&nbsp;next){
<a name="line1359"></a><div class="linenumber">1359</div><div style="width:2em;display:inline-block"></div>var&nbsp;easyrtcid&nbsp;=&nbsp;connectionObj.getEasyrtcid();
<a name="line1360"></a><div class="linenumber">1360</div><div style="width:2em;display:inline-block"></div>var&nbsp;appObj&nbsp;=&nbsp;connectionObj.getApp();
<a name="line1361"></a><div class="linenumber">1361</div>
<a name="line1362"></a><div class="linenumber">1362</div><div style="width:2em;display:inline-block"></div>pub.util.logDebug("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;Running&nbsp;func&nbsp;'onMsgTypeGetRoomList'");
<a name="line1363"></a><div class="linenumber">1363</div>
<a name="line1364"></a><div class="linenumber">1364</div><div style="width:2em;display:inline-block"></div>if(!_.isFunction(socketCallback))&nbsp;{
<a name="line1365"></a><div class="linenumber">1365</div><div style="width:4em;display:inline-block"></div>socketCallback&nbsp;=&nbsp;function(returnMsg)&nbsp;{
<a name="line1366"></a><div class="linenumber">1366</div><div style="width:6em;display:inline-block"></div>pub.util.logDebug("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;EasyRTC&nbsp;info:&nbsp;unhandled&nbsp;ACK&nbsp;return&nbsp;message.",&nbsp;returnMsg);
<a name="line1367"></a><div class="linenumber">1367</div><div style="width:4em;display:inline-block"></div>};
<a name="line1368"></a><div class="linenumber">1368</div><div style="width:2em;display:inline-block"></div>}
<a name="line1369"></a><div class="linenumber">1369</div>
<a name="line1370"></a><div class="linenumber">1370</div><div style="width:2em;display:inline-block"></div>if(!_.isFunction(next))&nbsp;{
<a name="line1371"></a><div class="linenumber">1371</div><div style="width:4em;display:inline-block"></div>next&nbsp;=&nbsp;pub.util.nextToNowhere;
<a name="line1372"></a><div class="linenumber">1372</div><div style="width:2em;display:inline-block"></div>}
<a name="line1373"></a><div class="linenumber">1373</div>
<a name="line1374"></a><div class="linenumber">1374</div><div style="width:2em;display:inline-block"></div>connectionObj.generateRoomList(
<a name="line1375"></a><div class="linenumber">1375</div><div style="width:4em;display:inline-block"></div>function(err,&nbsp;roomList)&nbsp;{
<a name="line1376"></a><div class="linenumber">1376</div><div style="width:6em;display:inline-block"></div>if(err)&nbsp;{
<a name="line1377"></a><div class="linenumber">1377</div><div style="width:8em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;pub.util.getErrorMsg("MSG_REJECT_NO_ROOM_LIST"),&nbsp;appObj);
<a name="line1378"></a><div class="linenumber">1378</div><div style="width:6em;display:inline-block"></div>}
<a name="line1379"></a><div class="linenumber">1379</div><div style="width:6em;display:inline-block"></div>else&nbsp;{
<a name="line1380"></a><div class="linenumber">1380</div><div style="width:8em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;{"msgType":"roomList",&nbsp;"msgData":{"roomList":roomList}},&nbsp;appObj);
<a name="line1381"></a><div class="linenumber">1381</div><div style="width:6em;display:inline-block"></div>}
<a name="line1382"></a><div class="linenumber">1382</div><div style="width:6em;display:inline-block"></div>next(null);
<a name="line1383"></a><div class="linenumber">1383</div><div style="width:4em;display:inline-block"></div>}
<a name="line1384"></a><div class="linenumber">1384</div><div style="width:2em;display:inline-block"></div>);
<a name="line1385"></a><div class="linenumber">1385</div><div style="width:0em;display:inline-block"></div>};
<a name="line1386"></a><div class="linenumber">1386</div>
<a name="line1387"></a><div class="linenumber">1387</div>
<a name="line1388"></a><div class="linenumber">1388</div><div style="width:0em;display:inline-block"></div>/**
<a name="line1389"></a><div class="linenumber">1389</div><div style="width:0em;display:inline-block"></div>*&nbsp;Default&nbsp;listener&nbsp;for&nbsp;event&nbsp;"msgTypeSetPresence".&nbsp;This&nbsp;event&nbsp;is&nbsp;fired&nbsp;when&nbsp;an&nbsp;easyrtcCmd&nbsp;message&nbsp;with&nbsp;msgType&nbsp;of&nbsp;"setPresence"&nbsp;is&nbsp;received&nbsp;from&nbsp;a&nbsp;client.&nbsp;
<a name="line1390"></a><div class="linenumber">1390</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line1391"></a><div class="linenumber">1391</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;connectionObj&nbsp;&nbsp;EasyRTC&nbsp;connection&nbsp;object.&nbsp;Contains&nbsp;methods&nbsp;used&nbsp;for&nbsp;identifying&nbsp;and&nbsp;managing&nbsp;a&nbsp;connection.
<a name="line1392"></a><div class="linenumber">1392</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;presenceObj&nbsp;&nbsp;&nbsp;&nbsp;Presence&nbsp;object&nbsp;which&nbsp;contains&nbsp;all&nbsp;the&nbsp;fields&nbsp;for&nbsp;setting&nbsp;a&nbsp;presence&nbsp;for&nbsp;a&nbsp;connection.
<a name="line1393"></a><div class="linenumber">1393</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Function}&nbsp;socketCallback&nbsp;Socket.io&nbsp;callback&nbsp;function&nbsp;which&nbsp;delivers&nbsp;a&nbsp;response&nbsp;to&nbsp;a&nbsp;socket.&nbsp;Expects&nbsp;a&nbsp;single&nbsp;parameter&nbsp;(msg).
<a name="line1394"></a><div class="linenumber">1394</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line1395"></a><div class="linenumber">1395</div><div style="width:0em;display:inline-block"></div>*/
<a name="line1396"></a><div class="linenumber">1396</div><div style="width:0em;display:inline-block"></div>eventListener.onMsgTypeSetPresence&nbsp;=&nbsp;function(connectionObj,&nbsp;presenceObj,&nbsp;socketCallback,&nbsp;next){
<a name="line1397"></a><div class="linenumber">1397</div><div style="width:2em;display:inline-block"></div>var&nbsp;easyrtcid&nbsp;=&nbsp;connectionObj.getEasyrtcid();
<a name="line1398"></a><div class="linenumber">1398</div><div style="width:2em;display:inline-block"></div>var&nbsp;appObj&nbsp;=&nbsp;connectionObj.getApp();
<a name="line1399"></a><div class="linenumber">1399</div>
<a name="line1400"></a><div class="linenumber">1400</div><div style="width:2em;display:inline-block"></div>pub.util.logDebug("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;Running&nbsp;func&nbsp;'onMsgTypeSetPresence'&nbsp;with&nbsp;setPresence:&nbsp;",presenceObj);
<a name="line1401"></a><div class="linenumber">1401</div><div style="width:2em;display:inline-block"></div>if(!_.isFunction(socketCallback))&nbsp;{
<a name="line1402"></a><div class="linenumber">1402</div><div style="width:4em;display:inline-block"></div>socketCallback&nbsp;=&nbsp;function(returnMsg)&nbsp;{
<a name="line1403"></a><div class="linenumber">1403</div><div style="width:6em;display:inline-block"></div>pub.util.logDebug("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;EasyRTC&nbsp;info:&nbsp;unhandled&nbsp;ACK&nbsp;return&nbsp;message.",&nbsp;returnMsg);
<a name="line1404"></a><div class="linenumber">1404</div><div style="width:4em;display:inline-block"></div>};
<a name="line1405"></a><div class="linenumber">1405</div><div style="width:2em;display:inline-block"></div>}
<a name="line1406"></a><div class="linenumber">1406</div>
<a name="line1407"></a><div class="linenumber">1407</div><div style="width:2em;display:inline-block"></div>if(!_.isFunction(next))&nbsp;{
<a name="line1408"></a><div class="linenumber">1408</div><div style="width:4em;display:inline-block"></div>next&nbsp;=&nbsp;pub.util.nextToNowhere;
<a name="line1409"></a><div class="linenumber">1409</div><div style="width:2em;display:inline-block"></div>}
<a name="line1410"></a><div class="linenumber">1410</div>
<a name="line1411"></a><div class="linenumber">1411</div><div style="width:2em;display:inline-block"></div>connectionObj.setPresence(
<a name="line1412"></a><div class="linenumber">1412</div><div style="width:4em;display:inline-block"></div>presenceObj,
<a name="line1413"></a><div class="linenumber">1413</div><div style="width:4em;display:inline-block"></div>function(err){
<a name="line1414"></a><div class="linenumber">1414</div><div style="width:6em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line1415"></a><div class="linenumber">1415</div><div style="width:8em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;pub.util.getErrorMsg("MSG_REJECT_PRESENCE"),&nbsp;appObj);
<a name="line1416"></a><div class="linenumber">1416</div><div style="width:6em;display:inline-block"></div>}
<a name="line1417"></a><div class="linenumber">1417</div><div style="width:6em;display:inline-block"></div>else&nbsp;{
<a name="line1418"></a><div class="linenumber">1418</div><div style="width:8em;display:inline-block"></div>connectionObj.emitRoomDataDelta(false,&nbsp;function(err,&nbsp;roomDataObj){
<a name="line1419"></a><div class="linenumber">1419</div><div style="width:10em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line1420"></a><div class="linenumber">1420</div><div style="width:12em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;pub.util.getErrorMsg("MSG_REJECT_PRESENCE"),&nbsp;appObj);
<a name="line1421"></a><div class="linenumber">1421</div><div style="width:10em;display:inline-block"></div>}
<a name="line1422"></a><div class="linenumber">1422</div><div style="width:10em;display:inline-block"></div>else&nbsp;{
<a name="line1423"></a><div class="linenumber">1423</div><div style="width:12em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;{"msgType":"roomData",&nbsp;"msgData":{"roomData":roomDataObj}},&nbsp;appObj);
<a name="line1424"></a><div class="linenumber">1424</div><div style="width:10em;display:inline-block"></div>}
<a name="line1425"></a><div class="linenumber">1425</div><div style="width:8em;display:inline-block"></div>});
<a name="line1426"></a><div class="linenumber">1426</div><div style="width:6em;display:inline-block"></div>}
<a name="line1427"></a><div class="linenumber">1427</div><div style="width:6em;display:inline-block"></div>next(null);
<a name="line1428"></a><div class="linenumber">1428</div><div style="width:4em;display:inline-block"></div>}
<a name="line1429"></a><div class="linenumber">1429</div><div style="width:2em;display:inline-block"></div>);
<a name="line1430"></a><div class="linenumber">1430</div><div style="width:0em;display:inline-block"></div>};
<a name="line1431"></a><div class="linenumber">1431</div>
<a name="line1432"></a><div class="linenumber">1432</div>
<a name="line1433"></a><div class="linenumber">1433</div><div style="width:0em;display:inline-block"></div>/**
<a name="line1434"></a><div class="linenumber">1434</div><div style="width:0em;display:inline-block"></div>*&nbsp;Default&nbsp;listener&nbsp;for&nbsp;event&nbsp;"msgTypeSetRoomApiField".&nbsp;This&nbsp;event&nbsp;is&nbsp;fired&nbsp;when&nbsp;an&nbsp;easyrtcCmd&nbsp;message&nbsp;with&nbsp;msgType&nbsp;of&nbsp;"setRoomApiField"&nbsp;is&nbsp;received&nbsp;from&nbsp;a&nbsp;client.&nbsp;
<a name="line1435"></a><div class="linenumber">1435</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line1436"></a><div class="linenumber">1436</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;connectionObj&nbsp;&nbsp;EasyRTC&nbsp;connection&nbsp;object.&nbsp;Contains&nbsp;methods&nbsp;used&nbsp;for&nbsp;identifying&nbsp;and&nbsp;managing&nbsp;a&nbsp;connection.
<a name="line1437"></a><div class="linenumber">1437</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;roomApiFieldObj&nbsp;Api&nbsp;Field&nbsp;object&nbsp;which&nbsp;contains&nbsp;all&nbsp;the&nbsp;fields&nbsp;for&nbsp;setting&nbsp;a&nbsp;presence&nbsp;for&nbsp;a&nbsp;connection.
<a name="line1438"></a><div class="linenumber">1438</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Function}&nbsp;socketCallback&nbsp;Socket.io&nbsp;callback&nbsp;function&nbsp;which&nbsp;delivers&nbsp;a&nbsp;response&nbsp;to&nbsp;a&nbsp;socket.&nbsp;Expects&nbsp;a&nbsp;single&nbsp;parameter&nbsp;(msg).
<a name="line1439"></a><div class="linenumber">1439</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line1440"></a><div class="linenumber">1440</div><div style="width:0em;display:inline-block"></div>*/
<a name="line1441"></a><div class="linenumber">1441</div><div style="width:0em;display:inline-block"></div>eventListener.onMsgTypeSetRoomApiField&nbsp;=&nbsp;function(connectionObj,&nbsp;roomApiFieldObj,&nbsp;socketCallback,&nbsp;next){
<a name="line1442"></a><div class="linenumber">1442</div><div style="width:2em;display:inline-block"></div>var&nbsp;easyrtcid&nbsp;=&nbsp;connectionObj.getEasyrtcid();
<a name="line1443"></a><div class="linenumber">1443</div><div style="width:2em;display:inline-block"></div>var&nbsp;appObj&nbsp;=&nbsp;connectionObj.getApp();
<a name="line1444"></a><div class="linenumber">1444</div>
<a name="line1445"></a><div class="linenumber">1445</div><div style="width:2em;display:inline-block"></div>pub.util.logDebug("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;Running&nbsp;func&nbsp;'onMsgTypeSetRoomApiField'&nbsp;with&nbsp;apiFieldObj:&nbsp;",roomApiFieldObj);
<a name="line1446"></a><div class="linenumber">1446</div><div style="width:2em;display:inline-block"></div>if(!_.isFunction(socketCallback))&nbsp;{
<a name="line1447"></a><div class="linenumber">1447</div><div style="width:4em;display:inline-block"></div>socketCallback&nbsp;=&nbsp;function(returnMsg)&nbsp;{
<a name="line1448"></a><div class="linenumber">1448</div><div style="width:6em;display:inline-block"></div>pub.util.logDebug("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;EasyRTC&nbsp;info:&nbsp;unhandled&nbsp;ACK&nbsp;return&nbsp;message.",&nbsp;returnMsg);
<a name="line1449"></a><div class="linenumber">1449</div><div style="width:4em;display:inline-block"></div>};
<a name="line1450"></a><div class="linenumber">1450</div><div style="width:2em;display:inline-block"></div>}
<a name="line1451"></a><div class="linenumber">1451</div>
<a name="line1452"></a><div class="linenumber">1452</div><div style="width:2em;display:inline-block"></div>if(!_.isFunction(next))&nbsp;{
<a name="line1453"></a><div class="linenumber">1453</div><div style="width:4em;display:inline-block"></div>next&nbsp;=&nbsp;pub.util.nextToNowhere;
<a name="line1454"></a><div class="linenumber">1454</div><div style="width:2em;display:inline-block"></div>}
<a name="line1455"></a><div class="linenumber">1455</div>
<a name="line1456"></a><div class="linenumber">1456</div><div style="width:2em;display:inline-block"></div>connectionObj.room(roomApiFieldObj.roomName,&nbsp;function(err,&nbsp;connectionRoomObj){
<a name="line1457"></a><div class="linenumber">1457</div><div style="width:4em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line1458"></a><div class="linenumber">1458</div><div style="width:6em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;pub.util.getErrorMsg("MSG_REJECT_BAD_ROOM"),&nbsp;appObj);
<a name="line1459"></a><div class="linenumber">1459</div><div style="width:6em;display:inline-block"></div>next(null);
<a name="line1460"></a><div class="linenumber">1460</div><div style="width:6em;display:inline-block"></div>return;
<a name="line1461"></a><div class="linenumber">1461</div><div style="width:4em;display:inline-block"></div>}
<a name="line1462"></a><div class="linenumber">1462</div><div style="width:4em;display:inline-block"></div>connectionRoomObj.setApiField(roomApiFieldObj.field,&nbsp;function(err){
<a name="line1463"></a><div class="linenumber">1463</div><div style="width:6em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line1464"></a><div class="linenumber">1464</div><div style="width:8em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;pub.util.getErrorMsg("MSG_REJECT_BAD_FIELD"),&nbsp;appObj);
<a name="line1465"></a><div class="linenumber">1465</div><div style="width:8em;display:inline-block"></div>next(null);
<a name="line1466"></a><div class="linenumber">1466</div><div style="width:8em;display:inline-block"></div>return;
<a name="line1467"></a><div class="linenumber">1467</div><div style="width:6em;display:inline-block"></div>}
<a name="line1468"></a><div class="linenumber">1468</div><div style="width:6em;display:inline-block"></div>connectionRoomObj.emitRoomDataDelta(false,&nbsp;function(err,&nbsp;roomDataDelta){
<a name="line1469"></a><div class="linenumber">1469</div><div style="width:8em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line1470"></a><div class="linenumber">1470</div><div style="width:10em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;pub.util.getErrorMsg("MSG_REJECT_GEN_FAIL"),&nbsp;appObj);
<a name="line1471"></a><div class="linenumber">1471</div><div style="width:10em;display:inline-block"></div>next(null);
<a name="line1472"></a><div class="linenumber">1472</div><div style="width:10em;display:inline-block"></div>return;
<a name="line1473"></a><div class="linenumber">1473</div><div style="width:8em;display:inline-block"></div>}
<a name="line1474"></a><div class="linenumber">1474</div>
<a name="line1475"></a><div class="linenumber">1475</div><div style="width:8em;display:inline-block"></div>var&nbsp;msg&nbsp;=&nbsp;{"msgType":"roomData",&nbsp;"msgData":&nbsp;{"roomData":&nbsp;{}}};
<a name="line1476"></a><div class="linenumber">1476</div><div style="width:8em;display:inline-block"></div>msg.msgData.roomData[roomApiFieldObj.roomName]&nbsp;=&nbsp;roomDataDelta;
<a name="line1477"></a><div class="linenumber">1477</div><div style="width:8em;display:inline-block"></div>pub.util.sendSocketCallbackMsg(easyrtcid,&nbsp;socketCallback,&nbsp;msg,&nbsp;appObj);
<a name="line1478"></a><div class="linenumber">1478</div><div style="width:6em;display:inline-block"></div>});
<a name="line1479"></a><div class="linenumber">1479</div><div style="width:4em;display:inline-block"></div>});
<a name="line1480"></a><div class="linenumber">1480</div><div style="width:2em;display:inline-block"></div>});
<a name="line1481"></a><div class="linenumber">1481</div><div style="width:0em;display:inline-block"></div>};
<a name="line1482"></a><div class="linenumber">1482</div>
<a name="line1483"></a><div class="linenumber">1483</div>
<a name="line1484"></a><div class="linenumber">1484</div><div style="width:0em;display:inline-block"></div>/**
<a name="line1485"></a><div class="linenumber">1485</div><div style="width:0em;display:inline-block"></div>*&nbsp;Default&nbsp;listener&nbsp;for&nbsp;event&nbsp;"getIceConfig".&nbsp;Returns&nbsp;an&nbsp;ICE&nbsp;configuration&nbsp;object&nbsp;to&nbsp;the&nbsp;callback.
<a name="line1486"></a><div class="linenumber">1486</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line1487"></a><div class="linenumber">1487</div><div style="width:0em;display:inline-block"></div>*&nbsp;The&nbsp;ICE&nbsp;configuration&nbsp;object&nbsp;will&nbsp;hold&nbsp;the&nbsp;array&nbsp;of&nbsp;STUN&nbsp;and&nbsp;TURN&nbsp;servers&nbsp;the&nbsp;connection&nbsp;should&nbsp;use&nbsp;when&nbsp;forming&nbsp;a&nbsp;peer&nbsp;connection.&nbsp;This&nbsp;default&nbsp;listener&nbsp;uses&nbsp;the&nbsp;"appIceServers"&nbsp;configuration&nbsp;option&nbsp;at&nbsp;the&nbsp;application&nbsp;level.
<a name="line1488"></a><div class="linenumber">1488</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line1489"></a><div class="linenumber">1489</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;connectionObj&nbsp;&nbsp;EasyRTC&nbsp;connection&nbsp;object.&nbsp;Contains&nbsp;methods&nbsp;used&nbsp;for&nbsp;identifying&nbsp;and&nbsp;managing&nbsp;a&nbsp;connection.
<a name="line1490"></a><div class="linenumber">1490</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Function}&nbsp;callback&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Callback&nbsp;of&nbsp;form&nbsp;(err,&nbsp;iceConfigArray)
<a name="line1491"></a><div class="linenumber">1491</div><div style="width:0em;display:inline-block"></div>*/
<a name="line1492"></a><div class="linenumber">1492</div><div style="width:0em;display:inline-block"></div>eventListener.onGetIceConfig&nbsp;=&nbsp;function(connectionObj,&nbsp;callback){
<a name="line1493"></a><div class="linenumber">1493</div><div style="width:2em;display:inline-block"></div>pub.util.logDebug("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;Running&nbsp;func&nbsp;'onGetIceConfig'");
<a name="line1494"></a><div class="linenumber">1494</div><div style="width:2em;display:inline-block"></div>callback(null,&nbsp;connectionObj.getApp().getOption("appIceServers"));
<a name="line1495"></a><div class="linenumber">1495</div><div style="width:0em;display:inline-block"></div>};
<a name="line1496"></a><div class="linenumber">1496</div>
<a name="line1497"></a><div class="linenumber">1497</div>
<a name="line1498"></a><div class="linenumber">1498</div><div style="width:0em;display:inline-block"></div>/**
<a name="line1499"></a><div class="linenumber">1499</div><div style="width:0em;display:inline-block"></div>*&nbsp;Default&nbsp;listener&nbsp;for&nbsp;event&nbsp;"roomCreate".&nbsp;Creates&nbsp;a&nbsp;room&nbsp;attached&nbsp;to&nbsp;an&nbsp;application&nbsp;with&nbsp;a&nbsp;specified&nbsp;room&nbsp;name.&nbsp;The&nbsp;optional&nbsp;creatorConnectionObj&nbsp;is&nbsp;provided&nbsp;to&nbsp;provide&nbsp;context;&nbsp;joining&nbsp;the&nbsp;room&nbsp;is&nbsp;done&nbsp;separately.&nbsp;If&nbsp;successful,&nbsp;the&nbsp;callback&nbsp;returns&nbsp;a&nbsp;roomObj.
<a name="line1500"></a><div class="linenumber">1500</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line1501"></a><div class="linenumber">1501</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;appObj&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EasyRTC&nbsp;application&nbsp;object.&nbsp;Contains&nbsp;methods&nbsp;used&nbsp;for&nbsp;identifying&nbsp;and&nbsp;managing&nbsp;an&nbsp;application.
<a name="line1502"></a><div class="linenumber">1502</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?Object}&nbsp;creatorConnectionObj&nbsp;EasyRTC&nbsp;connection&nbsp;object&nbsp;belonging&nbsp;to&nbsp;the&nbsp;creator&nbsp;of&nbsp;the&nbsp;room.&nbsp;Contains&nbsp;methods&nbsp;used&nbsp;for&nbsp;identifying&nbsp;and&nbsp;managing&nbsp;a&nbsp;connection.
<a name="line1503"></a><div class="linenumber">1503</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;roomName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Room&nbsp;name&nbsp;which&nbsp;uniquely&nbsp;identifies&nbsp;a&nbsp;room&nbsp;within&nbsp;an&nbsp;EasyRTC&nbsp;application.
<a name="line1504"></a><div class="linenumber">1504</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?Object}&nbsp;roomOptions&nbsp;&nbsp;&nbsp;Sets&nbsp;room&nbsp;level&nbsp;options.&nbsp;May&nbsp;be&nbsp;null&nbsp;or&nbsp;map&nbsp;of&nbsp;key/value&nbsp;pairs.
<a name="line1505"></a><div class="linenumber">1505</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Function}&nbsp;callback&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Callback&nbsp;of&nbsp;form&nbsp;(err,&nbsp;roomObj)
<a name="line1506"></a><div class="linenumber">1506</div><div style="width:0em;display:inline-block"></div>*/
<a name="line1507"></a><div class="linenumber">1507</div><div style="width:0em;display:inline-block"></div>eventListener.onRoomCreate&nbsp;=&nbsp;function(appObj,&nbsp;creatorConnectionObj,&nbsp;roomName,&nbsp;roomOptions,&nbsp;callback){
<a name="line1508"></a><div class="linenumber">1508</div><div style="width:2em;display:inline-block"></div>pub.util.logDebug("["+appObj.getAppName()+"]"&nbsp;+&nbsp;(creatorConnectionObj?"["+creatorConnectionObj.getEasyrtcid()+"]":"")&nbsp;+&nbsp;&nbsp;"&nbsp;Room&nbsp;["+&nbsp;roomName&nbsp;+"]&nbsp;Running&nbsp;func&nbsp;'onRoomCreate'");
<a name="line1509"></a><div class="linenumber">1509</div><div style="width:2em;display:inline-block"></div>appObj.createRoom(roomName,&nbsp;roomOptions,&nbsp;callback);
<a name="line1510"></a><div class="linenumber">1510</div><div style="width:0em;display:inline-block"></div>};
<a name="line1511"></a><div class="linenumber">1511</div>
<a name="line1512"></a><div class="linenumber">1512</div>
<a name="line1513"></a><div class="linenumber">1513</div><div style="width:0em;display:inline-block"></div>/**
<a name="line1514"></a><div class="linenumber">1514</div><div style="width:0em;display:inline-block"></div>*&nbsp;Default&nbsp;listener&nbsp;for&nbsp;event&nbsp;"roomJoin".&nbsp;Joins&nbsp;a&nbsp;connection&nbsp;to&nbsp;a&nbsp;a&nbsp;specified&nbsp;room.&nbsp;If&nbsp;successful,&nbsp;the&nbsp;callback&nbsp;will&nbsp;return&nbsp;a&nbsp;connectionRoomObj.
<a name="line1515"></a><div class="linenumber">1515</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line1516"></a><div class="linenumber">1516</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;connectionObj&nbsp;&nbsp;EasyRTC&nbsp;connection&nbsp;object.&nbsp;Contains&nbsp;methods&nbsp;used&nbsp;for&nbsp;identifying&nbsp;and&nbsp;managing&nbsp;a&nbsp;connection.
<a name="line1517"></a><div class="linenumber">1517</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;roomName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Room&nbsp;name&nbsp;which&nbsp;uniquely&nbsp;identifies&nbsp;a&nbsp;room&nbsp;within&nbsp;an&nbsp;EasyRTC&nbsp;application.
<a name="line1518"></a><div class="linenumber">1518</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{?Object}&nbsp;roomParameter&nbsp;A&nbsp;map(dictionary)&nbsp;object&nbsp;with&nbsp;key/value&nbsp;pairs.&nbsp;The&nbsp;values&nbsp;can&nbsp;be&nbsp;any&nbsp;JSONable&nbsp;object.&nbsp;This&nbsp;field&nbsp;is&nbsp;not&nbsp;currently&nbsp;looked&nbsp;at&nbsp;by&nbsp;EasyRTC,&nbsp;however&nbsp;it&nbsp;is&nbsp;available&nbsp;for&nbsp;custom&nbsp;server&nbsp;applications.&nbsp;May&nbsp;be&nbsp;used&nbsp;for&nbsp;room&nbsp;options&nbsp;or&nbsp;authentication&nbsp;needs.
<a name="line1519"></a><div class="linenumber">1519</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Function}&nbsp;callback&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Callback&nbsp;of&nbsp;form&nbsp;(err,&nbsp;connectionRoomObj)
<a name="line1520"></a><div class="linenumber">1520</div><div style="width:0em;display:inline-block"></div>*/
<a name="line1521"></a><div class="linenumber">1521</div><div style="width:0em;display:inline-block"></div>eventListener.onRoomJoin&nbsp;=&nbsp;function(connectionObj,&nbsp;roomName,&nbsp;roomParameter,&nbsp;callback){
<a name="line1522"></a><div class="linenumber">1522</div><div style="width:2em;display:inline-block"></div>pub.util.logDebug("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;Running&nbsp;func&nbsp;'onRoomJoin'");
<a name="line1523"></a><div class="linenumber">1523</div>
<a name="line1524"></a><div class="linenumber">1524</div><div style="width:2em;display:inline-block"></div>//&nbsp;roomParameter&nbsp;is&nbsp;a&nbsp;new&nbsp;field.&nbsp;To&nbsp;ease&nbsp;upgrading&nbsp;we'll&nbsp;just&nbsp;show&nbsp;a&nbsp;warning&nbsp;to&nbsp;server&nbsp;applications&nbsp;which&nbsp;haven't&nbsp;updated&nbsp;
<a name="line1525"></a><div class="linenumber">1525</div><div style="width:2em;display:inline-block"></div>if&nbsp;(_.isFunction(roomParameter)){
<a name="line1526"></a><div class="linenumber">1526</div><div style="width:4em;display:inline-block"></div>pub.util.logWarning("Upgrade&nbsp;notice:&nbsp;EasyRTC&nbsp;roomJoin&nbsp;event&nbsp;called&nbsp;without&nbsp;roomParameter&nbsp;object.");
<a name="line1527"></a><div class="linenumber">1527</div><div style="width:4em;display:inline-block"></div>callback&nbsp;=&nbsp;roomParameter;
<a name="line1528"></a><div class="linenumber">1528</div><div style="width:4em;display:inline-block"></div>roomParameter&nbsp;=&nbsp;null;
<a name="line1529"></a><div class="linenumber">1529</div><div style="width:2em;display:inline-block"></div>}
<a name="line1530"></a><div class="linenumber">1530</div>
<a name="line1531"></a><div class="linenumber">1531</div><div style="width:2em;display:inline-block"></div>connectionObj.joinRoom(roomName,&nbsp;function(err,&nbsp;connectionRoomObj){
<a name="line1532"></a><div class="linenumber">1532</div><div style="width:4em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line1533"></a><div class="linenumber">1533</div><div style="width:6em;display:inline-block"></div>callback(err);
<a name="line1534"></a><div class="linenumber">1534</div><div style="width:6em;display:inline-block"></div>return;
<a name="line1535"></a><div class="linenumber">1535</div><div style="width:4em;display:inline-block"></div>}
<a name="line1536"></a><div class="linenumber">1536</div><div style="width:4em;display:inline-block"></div>connectionRoomObj.emitRoomDataDelta(false,&nbsp;function(err,&nbsp;roomDataDelta){
<a name="line1537"></a><div class="linenumber">1537</div><div style="width:6em;display:inline-block"></div>//&nbsp;Return&nbsp;connectionRoomObj&nbsp;regardless&nbsp;of&nbsp;if&nbsp;there&nbsp;was&nbsp;a&nbsp;problem&nbsp;sending&nbsp;out&nbsp;the&nbsp;deltas
<a name="line1538"></a><div class="linenumber">1538</div><div style="width:6em;display:inline-block"></div>callback(null,&nbsp;connectionRoomObj);
<a name="line1539"></a><div class="linenumber">1539</div><div style="width:4em;display:inline-block"></div>});
<a name="line1540"></a><div class="linenumber">1540</div><div style="width:2em;display:inline-block"></div>});
<a name="line1541"></a><div class="linenumber">1541</div><div style="width:0em;display:inline-block"></div>};
<a name="line1542"></a><div class="linenumber">1542</div>
<a name="line1543"></a><div class="linenumber">1543</div>
<a name="line1544"></a><div class="linenumber">1544</div><div style="width:0em;display:inline-block"></div>/**
<a name="line1545"></a><div class="linenumber">1545</div><div style="width:0em;display:inline-block"></div>*&nbsp;Default&nbsp;listener&nbsp;for&nbsp;event&nbsp;"roomLeave".&nbsp;Run&nbsp;upon&nbsp;a&nbsp;connection&nbsp;leaving&nbsp;a&nbsp;room.
<a name="line1546"></a><div class="linenumber">1546</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line1547"></a><div class="linenumber">1547</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Object}&nbsp;connectionObj&nbsp;&nbsp;EasyRTC&nbsp;connection&nbsp;object.&nbsp;Contains&nbsp;methods&nbsp;used&nbsp;for&nbsp;identifying&nbsp;and&nbsp;managing&nbsp;a&nbsp;connection.
<a name="line1548"></a><div class="linenumber">1548</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{string}&nbsp;roomName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Room&nbsp;name&nbsp;which&nbsp;uniquely&nbsp;identifies&nbsp;a&nbsp;room&nbsp;within&nbsp;an&nbsp;EasyRTC&nbsp;application.
<a name="line1549"></a><div class="linenumber">1549</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line1550"></a><div class="linenumber">1550</div><div style="width:0em;display:inline-block"></div>*/
<a name="line1551"></a><div class="linenumber">1551</div><div style="width:0em;display:inline-block"></div>eventListener.onRoomLeave&nbsp;=&nbsp;function(connectionObj,&nbsp;roomName,&nbsp;next){
<a name="line1552"></a><div class="linenumber">1552</div><div style="width:2em;display:inline-block"></div>pub.util.logDebug("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;Running&nbsp;func&nbsp;'onRoomLeave'&nbsp;with&nbsp;rooms&nbsp;["+roomName+"]");
<a name="line1553"></a><div class="linenumber">1553</div>
<a name="line1554"></a><div class="linenumber">1554</div><div style="width:2em;display:inline-block"></div>if(!_.isFunction(next))&nbsp;{
<a name="line1555"></a><div class="linenumber">1555</div><div style="width:4em;display:inline-block"></div>next&nbsp;=&nbsp;pub.util.nextToNowhere;
<a name="line1556"></a><div class="linenumber">1556</div><div style="width:2em;display:inline-block"></div>}
<a name="line1557"></a><div class="linenumber">1557</div>
<a name="line1558"></a><div class="linenumber">1558</div><div style="width:2em;display:inline-block"></div>connectionObj.room(roomName,&nbsp;function(err,&nbsp;connectionRoomObj){
<a name="line1559"></a><div class="linenumber">1559</div><div style="width:4em;display:inline-block"></div>if&nbsp;(err)&nbsp;{
<a name="line1560"></a><div class="linenumber">1560</div><div style="width:6em;display:inline-block"></div>pub.util.logWarning("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;Couldn't&nbsp;leave&nbsp;room&nbsp;["&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"]");
<a name="line1561"></a><div class="linenumber">1561</div><div style="width:6em;display:inline-block"></div>next(err);
<a name="line1562"></a><div class="linenumber">1562</div><div style="width:6em;display:inline-block"></div>return;
<a name="line1563"></a><div class="linenumber">1563</div><div style="width:4em;display:inline-block"></div>}
<a name="line1564"></a><div class="linenumber">1564</div>
<a name="line1565"></a><div class="linenumber">1565</div><div style="width:4em;display:inline-block"></div>pub.util.logDebug("["+connectionObj.getAppName()+"]["+connectionObj.getEasyrtcid()+"]&nbsp;Leave&nbsp;room&nbsp;["&nbsp;+&nbsp;roomName&nbsp;+&nbsp;"]");
<a name="line1566"></a><div class="linenumber">1566</div><div style="width:4em;display:inline-block"></div>connectionRoomObj.leaveRoom(next);
<a name="line1567"></a><div class="linenumber">1567</div><div style="width:2em;display:inline-block"></div>});
<a name="line1568"></a><div class="linenumber">1568</div><div style="width:0em;display:inline-block"></div>};
<a name="line1569"></a><div class="linenumber">1569</div>
<a name="line1570"></a><div class="linenumber">1570</div>
<a name="line1571"></a><div class="linenumber">1571</div><div style="width:0em;display:inline-block"></div>/**
<a name="line1572"></a><div class="linenumber">1572</div><div style="width:0em;display:inline-block"></div>*&nbsp;Default&nbsp;listener&nbsp;for&nbsp;event&nbsp;"shutdown".&nbsp;This&nbsp;event&nbsp;is&nbsp;fired&nbsp;when&nbsp;the&nbsp;server&nbsp;is&nbsp;being&nbsp;shutdown.
<a name="line1573"></a><div class="linenumber">1573</div><div style="width:0em;display:inline-block"></div>*&nbsp;
<a name="line1574"></a><div class="linenumber">1574</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line1575"></a><div class="linenumber">1575</div><div style="width:0em;display:inline-block"></div>*/
<a name="line1576"></a><div class="linenumber">1576</div><div style="width:0em;display:inline-block"></div>eventListener.onShutdown&nbsp;=&nbsp;function(next){
<a name="line1577"></a><div class="linenumber">1577</div><div style="width:2em;display:inline-block"></div>pub.util.logDebug("Running&nbsp;func&nbsp;'onShutdown'");
<a name="line1578"></a><div class="linenumber">1578</div><div style="width:2em;display:inline-block"></div>next(null);
<a name="line1579"></a><div class="linenumber">1579</div><div style="width:0em;display:inline-block"></div>};
<a name="line1580"></a><div class="linenumber">1580</div>
<a name="line1581"></a><div class="linenumber">1581</div>
<a name="line1582"></a><div class="linenumber">1582</div><div style="width:0em;display:inline-block"></div>/**
<a name="line1583"></a><div class="linenumber">1583</div><div style="width:0em;display:inline-block"></div>*&nbsp;Default&nbsp;listener&nbsp;for&nbsp;event&nbsp;"startup".&nbsp;This&nbsp;event&nbsp;initializes&nbsp;EasyRTC&nbsp;server&nbsp;so&nbsp;it&nbsp;is&nbsp;ready&nbsp;for&nbsp;connections.
<a name="line1584"></a><div class="linenumber">1584</div><div style="width:0em;display:inline-block"></div>*
<a name="line1585"></a><div class="linenumber">1585</div><div style="width:0em;display:inline-block"></div>*&nbsp;@param&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{nextCallback}&nbsp;next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;success&nbsp;callback&nbsp;of&nbsp;form&nbsp;next(err).
<a name="line1586"></a><div class="linenumber">1586</div><div style="width:0em;display:inline-block"></div>*/
<a name="line1587"></a><div class="linenumber">1587</div><div style="width:0em;display:inline-block"></div>eventListener.onStartup&nbsp;=&nbsp;function(next){
<a name="line1588"></a><div class="linenumber">1588</div><div style="width:2em;display:inline-block"></div>if&nbsp;(!_.isFunction(next))&nbsp;{
<a name="line1589"></a><div class="linenumber">1589</div><div style="width:4em;display:inline-block"></div>next&nbsp;=&nbsp;pub.util.nextToNowhere;
<a name="line1590"></a><div class="linenumber">1590</div><div style="width:2em;display:inline-block"></div>}
<a name="line1591"></a><div class="linenumber">1591</div>
<a name="line1592"></a><div class="linenumber">1592</div><div style="width:2em;display:inline-block"></div>pub.util.logDebug("Running&nbsp;func&nbsp;'onStartup'");
<a name="line1593"></a><div class="linenumber">1593</div><div style="width:2em;display:inline-block"></div>async.waterfall([
<a name="line1594"></a><div class="linenumber">1594</div><div style="width:4em;display:inline-block"></div>function(callback)&nbsp;{
<a name="line1595"></a><div class="linenumber">1595</div><div style="width:6em;display:inline-block"></div>pub.util.logDebug("Configuring&nbsp;Http&nbsp;server");
<a name="line1596"></a><div class="linenumber">1596</div>
<a name="line1597"></a><div class="linenumber">1597</div><div style="width:6em;display:inline-block"></div>//&nbsp;Set&nbsp;the&nbsp;EasyRTC&nbsp;demos
<a name="line1598"></a><div class="linenumber">1598</div><div style="width:6em;display:inline-block"></div>if&nbsp;(pub.getOption("demosEnable"))&nbsp;{
<a name="line1599"></a><div class="linenumber">1599</div><div style="width:8em;display:inline-block"></div>pub.util.logDebug("Setting&nbsp;up&nbsp;demos&nbsp;to&nbsp;be&nbsp;accessed&nbsp;from&nbsp;'"&nbsp;+&nbsp;pub.getOption("demosPublicFolder")&nbsp;+&nbsp;"/'");
<a name="line1600"></a><div class="linenumber">1600</div><div style="width:8em;display:inline-block"></div>pub.httpApp.get(pub.getOption("demosPublicFolder")&nbsp;+&nbsp;"/*",&nbsp;function(req,&nbsp;res)&nbsp;{
<a name="line1601"></a><div class="linenumber">1601</div><div style="width:10em;display:inline-block"></div>(res.sendFile||res.sendfile).call(res,
<a name="line1602"></a><div class="linenumber">1602</div><div style="width:12em;display:inline-block"></div>"./demos/"&nbsp;+&nbsp;(req.params[0]&nbsp;?&nbsp;req.params[0]&nbsp;:&nbsp;"index.html"),
<a name="line1603"></a><div class="linenumber">1603</div><div style="width:12em;display:inline-block"></div>//&nbsp;TODO&nbsp;security&nbsp;check
<a name="line1604"></a><div class="linenumber">1604</div><div style="width:12em;display:inline-block"></div>{root:__dirname&nbsp;+&nbsp;"/../"},
<a name="line1605"></a><div class="linenumber">1605</div><div style="width:12em;display:inline-block"></div>function(err)&nbsp;{
<a name="line1606"></a><div class="linenumber">1606</div><div style="width:14em;display:inline-block"></div>try{if&nbsp;(err&nbsp;&amp;&amp;&nbsp;err.status&nbsp;&amp;&amp;&nbsp;res&nbsp;&amp;&amp;&nbsp;!res._headerSent)&nbsp;{
<a name="line1607"></a><div class="linenumber">1607</div><div style="width:16em;display:inline-block"></div>res.status(404);
<a name="line1608"></a><div class="linenumber">1608</div><div style="width:16em;display:inline-block"></div>var&nbsp;body&nbsp;=&nbsp;&nbsp;&nbsp;&nbsp;"&lt;html&gt;&lt;head&gt;&lt;title&gt;File&nbsp;Not&nbsp;Found&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;h1&gt;File&nbsp;Not&nbsp;Found&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;";
<a name="line1609"></a><div class="linenumber">1609</div><div style="width:16em;display:inline-block"></div>res.setHeader("Content-Type",&nbsp;"text/html");
<a name="line1610"></a><div class="linenumber">1610</div><div style="width:16em;display:inline-block"></div>res.setHeader("Content-Length",&nbsp;body.length);
<a name="line1611"></a><div class="linenumber">1611</div><div style="width:16em;display:inline-block"></div>res.end(body);
<a name="line1612"></a><div class="linenumber">1612</div><div style="width:14em;display:inline-block"></div>}}catch(e){}
<a name="line1613"></a><div class="linenumber">1613</div><div style="width:12em;display:inline-block"></div>}
<a name="line1614"></a><div class="linenumber">1614</div><div style="width:10em;display:inline-block"></div>);
<a name="line1615"></a><div class="linenumber">1615</div><div style="width:8em;display:inline-block"></div>});
<a name="line1616"></a><div class="linenumber">1616</div><div style="width:8em;display:inline-block"></div>//&nbsp;Forward&nbsp;people&nbsp;who&nbsp;forget&nbsp;the&nbsp;trailing&nbsp;slash&nbsp;to&nbsp;the&nbsp;folder.
<a name="line1617"></a><div class="linenumber">1617</div><div style="width:8em;display:inline-block"></div>pub.httpApp.get(pub.getOption("demosPublicFolder"),&nbsp;function(req,&nbsp;res)&nbsp;{res.redirect(pub.getOption("demosPublicFolder")&nbsp;+&nbsp;"/");});
<a name="line1618"></a><div class="linenumber">1618</div><div style="width:6em;display:inline-block"></div>}
<a name="line1619"></a><div class="linenumber">1619</div>
<a name="line1620"></a><div class="linenumber">1620</div><div style="width:6em;display:inline-block"></div>if&nbsp;(pub.getOption("apiEnable"))&nbsp;{
<a name="line1621"></a><div class="linenumber">1621</div><div style="width:8em;display:inline-block"></div>//&nbsp;Set&nbsp;the&nbsp;EasyRTC&nbsp;API&nbsp;files
<a name="line1622"></a><div class="linenumber">1622</div><div style="width:8em;display:inline-block"></div>pub.util.logDebug("Setting&nbsp;up&nbsp;API&nbsp;files&nbsp;to&nbsp;be&nbsp;accessed&nbsp;from&nbsp;'"&nbsp;+&nbsp;pub.getOption("apiPublicFolder")&nbsp;+&nbsp;"/'");
<a name="line1623"></a><div class="linenumber">1623</div><div style="width:8em;display:inline-block"></div>pub.httpApp.get(pub.getOption("apiPublicFolder")&nbsp;+&nbsp;"/easyrtc.js",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function(req,&nbsp;res)&nbsp;{pub.util.sendSessionCookie(req,&nbsp;res);&nbsp;(res.sendFile||res.sendfile).call(res,"api/easyrtc.js",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{root:__dirname&nbsp;+&nbsp;"/../"});});
<a name="line1624"></a><div class="linenumber">1624</div><div style="width:8em;display:inline-block"></div>pub.httpApp.get(pub.getOption("apiPublicFolder")&nbsp;+&nbsp;"/easyrtc_ft.js",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function(req,&nbsp;res)&nbsp;{pub.util.sendSessionCookie(req,&nbsp;res);&nbsp;(res.sendFile||res.sendfile).call(res,"api/easyrtc_ft.js",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{root:__dirname&nbsp;+&nbsp;"/../"});});
<a name="line1625"></a><div class="linenumber">1625</div><div style="width:8em;display:inline-block"></div>pub.httpApp.get(pub.getOption("apiPublicFolder")&nbsp;+&nbsp;"/easyrtc.css",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function(req,&nbsp;res)&nbsp;{pub.util.sendSessionCookie(req,&nbsp;res);&nbsp;(res.sendFile||res.sendfile).call(res,"api/easyrtc.css",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{root:__dirname&nbsp;+&nbsp;"/../"});});
<a name="line1626"></a><div class="linenumber">1626</div><div style="width:8em;display:inline-block"></div>pub.httpApp.get(pub.getOption("apiPublicFolder")&nbsp;+&nbsp;"/easyrtc.min.js",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function(req,&nbsp;res)&nbsp;{pub.util.sendSessionCookie(req,&nbsp;res);&nbsp;(res.sendFile||res.sendfile).call(res,"open_source/api/easyrtc.min.js",&nbsp;&nbsp;&nbsp;{root:__dirname&nbsp;+&nbsp;"/../"});});
<a name="line1627"></a><div class="linenumber">1627</div><div style="width:8em;display:inline-block"></div>pub.httpApp.get(pub.getOption("apiPublicFolder")&nbsp;+&nbsp;"/easyrtc_ft.min.js",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function(req,&nbsp;res)&nbsp;{pub.util.sendSessionCookie(req,&nbsp;res);&nbsp;(res.sendFile||res.sendfile).call(res,"api/easyrtc_ft.min.js",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{root:__dirname&nbsp;+&nbsp;"/../"});});
<a name="line1628"></a><div class="linenumber">1628</div><div style="width:8em;display:inline-block"></div>pub.httpApp.get(pub.getOption("apiPublicFolder")&nbsp;+&nbsp;"/easyrtc.min.css",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function(req,&nbsp;res)&nbsp;{pub.util.sendSessionCookie(req,&nbsp;res);&nbsp;(res.sendFile||res.sendfile).call(res,"open_source/api/easyrtc.min.css",&nbsp;&nbsp;{root:__dirname&nbsp;+&nbsp;"/../"});});
<a name="line1629"></a><div class="linenumber">1629</div><div style="width:8em;display:inline-block"></div>pub.httpApp.get(pub.getOption("apiPublicFolder")&nbsp;+&nbsp;"/img/*",&nbsp;function(req,&nbsp;res)&nbsp;{
<a name="line1630"></a><div class="linenumber">1630</div><div style="width:10em;display:inline-block"></div>pub.util.sendSessionCookie(req,&nbsp;res);&nbsp;
<a name="line1631"></a><div class="linenumber">1631</div><div style="width:10em;display:inline-block"></div>(res.sendFile||res.sendfile).call(res,
<a name="line1632"></a><div class="linenumber">1632</div><div style="width:12em;display:inline-block"></div>"./api/img/"&nbsp;+&nbsp;(req.params[0]&nbsp;?&nbsp;req.params[0]&nbsp;:&nbsp;"index.html"),
<a name="line1633"></a><div class="linenumber">1633</div><div style="width:12em;display:inline-block"></div>{root:__dirname&nbsp;+&nbsp;"/../"},
<a name="line1634"></a><div class="linenumber">1634</div><div style="width:12em;display:inline-block"></div>function(err)&nbsp;{
<a name="line1635"></a><div class="linenumber">1635</div><div style="width:14em;display:inline-block"></div>try{if&nbsp;(err&nbsp;&amp;&amp;&nbsp;err.status&nbsp;&amp;&amp;&nbsp;res&nbsp;&amp;&amp;&nbsp;!res._headerSent)&nbsp;{
<a name="line1636"></a><div class="linenumber">1636</div><div style="width:16em;display:inline-block"></div>res.status(404);
<a name="line1637"></a><div class="linenumber">1637</div><div style="width:16em;display:inline-block"></div>var&nbsp;body&nbsp;=&nbsp;&nbsp;&nbsp;&nbsp;"&lt;html&gt;&lt;head&gt;&lt;title&gt;File&nbsp;Not&nbsp;Found&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;h1&gt;File&nbsp;Not&nbsp;Found&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;";
<a name="line1638"></a><div class="linenumber">1638</div><div style="width:16em;display:inline-block"></div>res.setHeader("Content-Type",&nbsp;"text/html");
<a name="line1639"></a><div class="linenumber">1639</div><div style="width:16em;display:inline-block"></div>res.setHeader("Content-Length",&nbsp;body.length);
<a name="line1640"></a><div class="linenumber">1640</div><div style="width:16em;display:inline-block"></div>res.end(body);
<a name="line1641"></a><div class="linenumber">1641</div><div style="width:14em;display:inline-block"></div>}}catch(e){}
<a name="line1642"></a><div class="linenumber">1642</div><div style="width:12em;display:inline-block"></div>}
<a name="line1643"></a><div class="linenumber">1643</div><div style="width:10em;display:inline-block"></div>);
<a name="line1644"></a><div class="linenumber">1644</div><div style="width:8em;display:inline-block"></div>});
<a name="line1645"></a><div class="linenumber">1645</div><div style="width:8em;display:inline-block"></div>if(pub.getOption("apiLabsEnable")){
<a name="line1646"></a><div class="linenumber">1646</div><div style="width:10em;display:inline-block"></div>pub.httpApp.get(pub.getOption("apiPublicFolder")&nbsp;+&nbsp;"/labs/*",&nbsp;function(req,&nbsp;res)&nbsp;{
<a name="line1647"></a><div class="linenumber">1647</div><div style="width:12em;display:inline-block"></div>pub.util.sendSessionCookie(req,&nbsp;res);
<a name="line1648"></a><div class="linenumber">1648</div><div style="width:12em;display:inline-block"></div>(res.sendFile||res.sendfile).call(res,
<a name="line1649"></a><div class="linenumber">1649</div><div style="width:16em;display:inline-block"></div>"./api/labs/"&nbsp;+&nbsp;(req.params[0]&nbsp;?&nbsp;req.params[0]&nbsp;:&nbsp;"index.html"),
<a name="line1650"></a><div class="linenumber">1650</div><div style="width:14em;display:inline-block"></div>{root:__dirname&nbsp;+&nbsp;"/../"},
<a name="line1651"></a><div class="linenumber">1651</div><div style="width:14em;display:inline-block"></div>function(err)&nbsp;{
<a name="line1652"></a><div class="linenumber">1652</div><div style="width:16em;display:inline-block"></div>try{if&nbsp;(err&nbsp;&amp;&amp;&nbsp;err.status&nbsp;&amp;&amp;&nbsp;res&nbsp;&amp;&amp;&nbsp;!res._headerSent)&nbsp;{
<a name="line1653"></a><div class="linenumber">1653</div><div style="width:18em;display:inline-block"></div>res.status(404);
<a name="line1654"></a><div class="linenumber">1654</div><div style="width:18em;display:inline-block"></div>var&nbsp;body&nbsp;=&nbsp;&nbsp;&nbsp;&nbsp;"&lt;html&gt;&lt;head&gt;&lt;title&gt;File&nbsp;Not&nbsp;Found&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;h1&gt;File&nbsp;Not&nbsp;Found&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;";
<a name="line1655"></a><div class="linenumber">1655</div><div style="width:18em;display:inline-block"></div>res.setHeader("Content-Type",&nbsp;"text/html");
<a name="line1656"></a><div class="linenumber">1656</div><div style="width:18em;display:inline-block"></div>res.setHeader("Content-Length",&nbsp;body.length);
<a name="line1657"></a><div class="linenumber">1657</div><div style="width:18em;display:inline-block"></div>res.end(body);
<a name="line1658"></a><div class="linenumber">1658</div><div style="width:16em;display:inline-block"></div>}}catch(e){}
<a name="line1659"></a><div class="linenumber">1659</div><div style="width:14em;display:inline-block"></div>}
<a name="line1660"></a><div class="linenumber">1660</div><div style="width:12em;display:inline-block"></div>);
<a name="line1661"></a><div class="linenumber">1661</div><div style="width:10em;display:inline-block"></div>});
<a name="line1662"></a><div class="linenumber">1662</div><div style="width:8em;display:inline-block"></div>}
<a name="line1663"></a><div class="linenumber">1663</div><div style="width:6em;display:inline-block"></div>}
<a name="line1664"></a><div class="linenumber">1664</div>
<a name="line1665"></a><div class="linenumber">1665</div><div style="width:6em;display:inline-block"></div>if&nbsp;(pub.getOption("apiEnable")&nbsp;&amp;&amp;&nbsp;pub.getOption("apiOldLocationEnable"))&nbsp;{
<a name="line1666"></a><div class="linenumber">1666</div><div style="width:8em;display:inline-block"></div>pub.util.logWarning("Enabling&nbsp;listening&nbsp;for&nbsp;API&nbsp;files&nbsp;in&nbsp;older&nbsp;depreciated&nbsp;location.");
<a name="line1667"></a><div class="linenumber">1667</div><div style="width:8em;display:inline-block"></div>//&nbsp;Transition&nbsp;-&nbsp;Old&nbsp;locations&nbsp;of&nbsp;EasyRTC&nbsp;API&nbsp;files
<a name="line1668"></a><div class="linenumber">1668</div><div style="width:8em;display:inline-block"></div>pub.httpApp.get("/js/easyrtc.js",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function(req,&nbsp;res)&nbsp;{(res.sendFile||res.sendfile).call(res,"api/easyrtc.js",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{root:__dirname&nbsp;+&nbsp;"/../"});});
<a name="line1669"></a><div class="linenumber">1669</div><div style="width:8em;display:inline-block"></div>pub.httpApp.get("/css/easyrtc.css",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function(req,&nbsp;res)&nbsp;{(res.sendFile||res.sendfile).call(res,"api/easyrtc.css",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{root:__dirname&nbsp;+&nbsp;"/../"});});
<a name="line1670"></a><div class="linenumber">1670</div><div style="width:6em;display:inline-block"></div>}
<a name="line1671"></a><div class="linenumber">1671</div><div style="width:6em;display:inline-block"></div>callback(null);
<a name="line1672"></a><div class="linenumber">1672</div><div style="width:4em;display:inline-block"></div>},
<a name="line1673"></a><div class="linenumber">1673</div>
<a name="line1674"></a><div class="linenumber">1674</div><div style="width:4em;display:inline-block"></div>function(callback)&nbsp;{
<a name="line1675"></a><div class="linenumber">1675</div><div style="width:6em;display:inline-block"></div>pub.util.logDebug("Configuring&nbsp;Socket&nbsp;server");
<a name="line1676"></a><div class="linenumber">1676</div>
<a name="line1677"></a><div class="linenumber">1677</div><div style="width:6em;display:inline-block"></div>pub.socketServer.sockets.on("connection",&nbsp;function&nbsp;(socket)&nbsp;{
<a name="line1678"></a><div class="linenumber">1678</div><div style="width:8em;display:inline-block"></div>var&nbsp;easyrtcid&nbsp;=&nbsp;pub.util.getAvailableEasyrtcid();
<a name="line1679"></a><div class="linenumber">1679</div>
<a name="line1680"></a><div class="linenumber">1680</div><div style="width:8em;display:inline-block"></div>pub.util.logDebug("["+easyrtcid+"]["+socket.id+"]&nbsp;Socket&nbsp;connected");
<a name="line1681"></a><div class="linenumber">1681</div><div style="width:8em;display:inline-block"></div>pub.util.logDebug("Emitting&nbsp;event&nbsp;'connection'");
<a name="line1682"></a><div class="linenumber">1682</div><div style="width:8em;display:inline-block"></div>pub.events.emit("connection",&nbsp;socket,&nbsp;easyrtcid,&nbsp;function(err){
<a name="line1683"></a><div class="linenumber">1683</div><div style="width:10em;display:inline-block"></div>if(err){
<a name="line1684"></a><div class="linenumber">1684</div><div style="width:12em;display:inline-block"></div>socket.disconnect();
<a name="line1685"></a><div class="linenumber">1685</div><div style="width:12em;display:inline-block"></div>pub.util.logError("["+easyrtcid+"]&nbsp;Connect&nbsp;error",&nbsp;err);
<a name="line1686"></a><div class="linenumber">1686</div><div style="width:10em;display:inline-block"></div>}
<a name="line1687"></a><div class="linenumber">1687</div><div style="width:8em;display:inline-block"></div>});
<a name="line1688"></a><div class="linenumber">1688</div><div style="width:6em;display:inline-block"></div>});
<a name="line1689"></a><div class="linenumber">1689</div><div style="width:6em;display:inline-block"></div>callback(null);
<a name="line1690"></a><div class="linenumber">1690</div><div style="width:4em;display:inline-block"></div>},
<a name="line1691"></a><div class="linenumber">1691</div>
<a name="line1692"></a><div class="linenumber">1692</div><div style="width:4em;display:inline-block"></div>//&nbsp;Setup&nbsp;default&nbsp;application
<a name="line1693"></a><div class="linenumber">1693</div><div style="width:4em;display:inline-block"></div>function(callback)&nbsp;{
<a name="line1694"></a><div class="linenumber">1694</div><div style="width:6em;display:inline-block"></div>pub.createApp(pub.getOption("appDefaultName"),&nbsp;null,&nbsp;callback);
<a name="line1695"></a><div class="linenumber">1695</div><div style="width:4em;display:inline-block"></div>},
<a name="line1696"></a><div class="linenumber">1696</div>
<a name="line1697"></a><div class="linenumber">1697</div><div style="width:4em;display:inline-block"></div>function(appObj,&nbsp;callback)&nbsp;{
<a name="line1698"></a><div class="linenumber">1698</div><div style="width:6em;display:inline-block"></div>//&nbsp;Checks&nbsp;to&nbsp;see&nbsp;if&nbsp;there&nbsp;is&nbsp;a&nbsp;newer&nbsp;version&nbsp;of&nbsp;EasyRTC&nbsp;available
<a name="line1699"></a><div class="linenumber">1699</div><div style="width:6em;display:inline-block"></div>if&nbsp;(pub.getOption("updateCheckEnable"))&nbsp;{
<a name="line1700"></a><div class="linenumber">1700</div><div style="width:8em;display:inline-block"></div>pub.util.updateCheck();
<a name="line1701"></a><div class="linenumber">1701</div><div style="width:6em;display:inline-block"></div>}
<a name="line1702"></a><div class="linenumber">1702</div><div style="width:6em;display:inline-block"></div>callback(null);
<a name="line1703"></a><div class="linenumber">1703</div><div style="width:4em;display:inline-block"></div>}
<a name="line1704"></a><div class="linenumber">1704</div><div style="width:2em;display:inline-block"></div>],
<a name="line1705"></a><div class="linenumber">1705</div><div style="width:2em;display:inline-block"></div>//&nbsp;This&nbsp;function&nbsp;is&nbsp;called&nbsp;upon&nbsp;completion&nbsp;of&nbsp;the&nbsp;async&nbsp;waterfall,&nbsp;or&nbsp;upon&nbsp;an&nbsp;error&nbsp;being&nbsp;thrown.
<a name="line1706"></a><div class="linenumber">1706</div><div style="width:2em;display:inline-block"></div>function&nbsp;(err)&nbsp;{
<a name="line1707"></a><div class="linenumber">1707</div><div style="width:4em;display:inline-block"></div>next(err);
<a name="line1708"></a><div class="linenumber">1708</div><div style="width:2em;display:inline-block"></div>});
<a name="line1709"></a><div class="linenumber">1709</div><div style="width:0em;display:inline-block"></div>};
</code></pre>
</article>
</section>
</div>
		
	</div>
</div>
<footer class="template">
	<div class="wrapper-content">
		<p>Copyright &copy;2016 EasyRTC</p>
	</div>
</footer>
<!-- <script>prettyPrint();</script> -->
<!-- <script src="scripts/linenumber.js"></script> -->
</body>
</html>